Package: org.codehaus.groovy.classgen

## [Java] Class AsmClassGenerator

- org.codehaus.groovy.classgen.AsmClassGenerator

- Generates Java class versions of Groovy classes using ASM.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static boolean` | `ASM_DEBUG` |
    `static boolean` | `CREATE_DEBUG_INFO` |
    `static boolean` | `CREATE_LINE_NUMBER_INFO` |
    `static String` | `MINIMUM_BYTECODE_VERSION` |
    `static MethodCallerMultiAdapter` | `getField` |
    `static MethodCallerMultiAdapter` | `getGroovyObjectField` |
    `static MethodCallerMultiAdapter` | `setField` |
    `static MethodCallerMultiAdapter` | `setGroovyObjectField` |
    `static MethodCallerMultiAdapter` | `setProperty` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class ClassGenerator` | `innerClasses`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `AsmClassGenerator (SourceUnit source, GeneratorContext context, org.objectweb.asm.ClassVisitor classVisitor, String sourceFile)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `boolean` | `addInnerClass(ClassNode innerClass)`
    `` | `static int` | `argumentSize(Expression arguments)`
    `` | `static boolean` | `containsSpreadExpression(Expression arguments)`
    `` | `protected void` | `createInterfaceSyntheticStaticFields()`
    `` | `protected void` | `createSyntheticStaticFields()`
    `` | `void` | `despreadList(List<Expression> expressions, boolean wrap)`
    `` | `WriterController` | `getController()`
    `` | `static FieldNode` | `getDeclaredFieldOfCurrentClassOrAccessibleFieldOfSuper(ClassNode accessingNode, ClassNode current, String name, boolean skipCurrent)`
    `` | `SourceUnit` | `getSourceUnit()`
    `` | `static boolean` | `isNullConstant(Expression expression)`
    `` | `static boolean` | `isSuperExpression(Expression expression)`
    `` | `static boolean` | `isThisExpression(Expression expression)`
    `` | `void` | `loadInstanceField(FieldExpression fldExp)` RHS instance field. should move most of the code in the BytecodeHelper
    `` | `void` | `loadStaticField(FieldExpression fldExp)`
    `` | `protected void` | `loadThisOrOwner()` Loads either this object or if we're inside a closure then load the top level owner
    `` | `void` | `loadWrapper(Expression argument)`
    `` | `void` | `onLineNumber(ASTNode statement, String message)`
    `` | `void` | `throwException(String message)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visit(org.objectweb.asm.MethodVisitor mv)`
    `` | `void` | `visitAnnotations(AnnotatedNode node)`
    `` | `void` | `visitArgumentlistExpression(ArgumentListExpression ale)`
    `` | `void` | `visitArrayExpression(ArrayExpression expression)`
    `` | `void` | `visitAssertStatement(AssertStatement statement)`
    `` | `void` | `visitAttributeExpression(AttributeExpression expression)`
    `` | `void` | `visitBinaryExpression(BinaryExpression expression)`
    `` | `void` | `visitBitwiseNegationExpression(BitwiseNegationExpression expression)`
    `` | `void` | `visitBlockStatement(BlockStatement statement)`
    `` | `void` | `visitBooleanExpression(BooleanExpression expression)`
    `` | `void` | `visitBreakStatement(BreakStatement statement)`
    `` | `void` | `visitBytecodeExpression(BytecodeExpression expression)`
    `` | `void` | `visitBytecodeSequence(BytecodeSequence bytecodeSequence)`
    `` | `void` | `visitCaseStatement(CaseStatement statement)`
    `` | `void` | `visitCastExpression(CastExpression castExpression)`
    `` | `void` | `visitCatchStatement(CatchStatement statement)`
    `` | `void` | `visitClass(ClassNode classNode)`
    `` | `void` | `visitClassExpression(ClassExpression expression)`
    `` | `void` | `visitClosureExpression(ClosureExpression expression)`
    `` | `void` | `visitClosureListExpression(ClosureListExpression expression)`
    `` | `void` | `visitConstantExpression(ConstantExpression expression)` Generates byte code for constants.
    `` | `void` | `visitConstructor(ConstructorNode node)`
    `` | `void` | `visitConstructorCallExpression(ConstructorCallExpression call)`
    `` | `protected void` | `visitConstructorOrMethod(MethodNode node, boolean isConstructor)`
    `` | `void` | `visitContinueStatement(ContinueStatement statement)`
    `` | `void` | `visitDeclarationExpression(DeclarationExpression expression)`
    `` | `void` | `visitDoWhileLoop(DoWhileStatement statement)`
    `` | `void` | `visitExpressionStatement(ExpressionStatement statement)`
    `` | `void` | `visitField(FieldNode fieldNode)`
    `` | `void` | `visitFieldExpression(FieldExpression expression)`
    `` | `void` | `visitForLoop(ForStatement statement)`
    `` | `void` | `visitGStringExpression(GStringExpression expression)`
    `` | `void` | `visitGenericType(GenericsType genericsType)`
    `` | `void` | `visitIfElse(IfStatement statement)`
    `` | `void` | `visitLambdaExpression(LambdaExpression expression)`
    `` | `void` | `visitListExpression(ListExpression expression)`
    `` | `void` | `visitMapEntryExpression(MapEntryExpression expression)`
    `` | `void` | `visitMapExpression(MapExpression expression)`
    `` | `void` | `visitMethod(MethodNode node)`
    `` | `void` | `visitMethodCallExpression(MethodCallExpression call)`
    `` | `void` | `visitMethodPointerExpression(MethodPointerExpression expression)`
    `` | `void` | `visitMethodReferenceExpression(MethodReferenceExpression expression)`
    `` | `void` | `visitNotExpression(NotExpression expression)`
    `` | `void` | `visitPostfixExpression(PostfixExpression expression)`
    `` | `void` | `visitPrefixExpression(PrefixExpression expression)`
    `` | `void` | `visitProperty(PropertyNode statement)`
    `` | `void` | `visitPropertyExpression(PropertyExpression expression)`
    `` | `void` | `visitRangeExpression(RangeExpression expression)`
    `` | `void` | `visitReturnStatement(ReturnStatement statement)`
    `` | `void` | `visitSpreadExpression(SpreadExpression expression)`
    `` | `void` | `visitSpreadMapExpression(SpreadMapExpression expression)`
    `` | `protected void` | `visitStatement(Statement statement)`
    `` | `void` | `visitStaticMethodCallExpression(StaticMethodCallExpression call)`
    `` | `void` | `visitSwitch(SwitchStatement statement)`
    `` | `void` | `visitSynchronizedStatement(SynchronizedStatement statement)`
    `` | `void` | `visitTernaryExpression(TernaryExpression expression)`
    `` | `void` | `visitThrowStatement(ThrowStatement statement)`
    `` | `void` | `visitTryCatchFinally(TryCatchStatement statement)`
    `` | `void` | `visitTupleExpression(TupleExpression expression)`
    `` | `void` | `visitUnaryMinusExpression(UnaryMinusExpression expression)`
    `` | `void` | `visitUnaryPlusExpression(UnaryPlusExpression expression)`
    `` | `void` | `visitVariableExpression(VariableExpression expression)`
    `` | `void` | `visitWhileLoop(WhileStatement statement)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ClassGenerator` | `getInnerClasses, getSourceUnit, visitBytecodeSequence`
    `class ClassCodeVisitorSupport` | `addError, getSourceUnit, visitAnnotation, visitAnnotations, visitAssertStatement, visitBlockStatement, visitBreakStatement, visitCaseStatement, visitCatchStatement, visitClass, visitClassCodeContainer, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally, visitWhileLoop`
    `class CodeVisitorSupport` | `afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop`

- - ### Field Detail

    - #### public static final boolean ASM_DEBUG

    - #### public static final boolean CREATE_DEBUG_INFO

    - #### public static final boolean CREATE_LINE_NUMBER_INFO

    - #### public static final String MINIMUM_BYTECODE_VERSION

    - #### public static final MethodCallerMultiAdapter getField

    - #### public static final MethodCallerMultiAdapter getGroovyObjectField

    - #### public static final MethodCallerMultiAdapter setField

    - #### public static final MethodCallerMultiAdapter setGroovyObjectField

    - #### public static final MethodCallerMultiAdapter setProperty

  - ### Constructor Detail

    - #### public AsmClassGenerator(SourceUnit source, GeneratorContext context, org.objectweb.asm.ClassVisitor classVisitor, String sourceFile)

  - ### Method Detail

    - #### public boolean addInnerClass(ClassNode innerClass)

    - #### public static int argumentSize(Expression arguments)

    - #### public static boolean containsSpreadExpression(Expression arguments)

    - #### protected void createInterfaceSyntheticStaticFields()

    - #### protected void createSyntheticStaticFields()

    - #### public void despreadList(List<Expression> expressions, boolean wrap)

    - #### public WriterController getController()

    - #### public static FieldNode getDeclaredFieldOfCurrentClassOrAccessibleFieldOfSuper(ClassNode accessingNode, ClassNode current, String name, boolean skipCurrent)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public SourceUnit getSourceUnit()

    - #### public static boolean isNullConstant(Expression expression)

    - #### public static boolean isSuperExpression(Expression expression)

    - #### public static boolean isThisExpression(Expression expression)

    - #### public void loadInstanceField(FieldExpression fldExp)

      RHS instance field. should move most of the code in the BytecodeHelper

    - #### public void loadStaticField(FieldExpression fldExp)

    - #### protected void loadThisOrOwner()

      Loads either this object or if we're inside a closure then load the top level owner

    - #### public void loadWrapper(Expression argument)

    - #### public void onLineNumber(ASTNode statement, String message)

    - #### public void throwException(String message)

    - #### public void visit(org.objectweb.asm.MethodVisitor mv)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitAnnotations(AnnotatedNode node)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitArgumentlistExpression(ArgumentListExpression ale)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitArrayExpression(ArrayExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitAssertStatement(AssertStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitAttributeExpression(AttributeExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitBinaryExpression(BinaryExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitBlockStatement(BlockStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitBooleanExpression(BooleanExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitBreakStatement(BreakStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitBytecodeExpression(BytecodeExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitBytecodeSequence(BytecodeSequence bytecodeSequence)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitCaseStatement(CaseStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitCastExpression(CastExpression castExpression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitCatchStatement(CatchStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitClass(ClassNode classNode)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitClassExpression(ClassExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitClosureExpression(ClosureExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitClosureListExpression(ClosureListExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitConstantExpression(ConstantExpression expression)

      Generates byte code for constants.

      See Also:
        Class field types

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitConstructor(ConstructorNode node)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitConstructorCallExpression(ConstructorCallExpression call)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitContinueStatement(ContinueStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitDeclarationExpression(DeclarationExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitDoWhileLoop(DoWhileStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitExpressionStatement(ExpressionStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitField(FieldNode fieldNode)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitFieldExpression(FieldExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitForLoop(ForStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitGStringExpression(GStringExpression expression)

    - #### public void visitGenericType(GenericsType genericsType)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitIfElse(IfStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitLambdaExpression(LambdaExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitListExpression(ListExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitMapEntryExpression(MapEntryExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitMapExpression(MapExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitMethod(MethodNode node)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitMethodCallExpression(MethodCallExpression call)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitMethodPointerExpression(MethodPointerExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitMethodReferenceExpression(MethodReferenceExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitNotExpression(NotExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitPostfixExpression(PostfixExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitPrefixExpression(PrefixExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitProperty(PropertyNode statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitPropertyExpression(PropertyExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitRangeExpression(RangeExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitReturnStatement(ReturnStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitSpreadExpression(SpreadExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitSpreadMapExpression(SpreadMapExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride protected void visitStatement(Statement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitStaticMethodCallExpression(StaticMethodCallExpression call)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitSwitch(SwitchStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitSynchronizedStatement(SynchronizedStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitTernaryExpression(TernaryExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitThrowStatement(ThrowStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitTryCatchFinally(TryCatchStatement statement)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitTupleExpression(TupleExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitUnaryMinusExpression(UnaryMinusExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitUnaryPlusExpression(UnaryPlusExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitVariableExpression(VariableExpression expression)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void visitWhileLoop(WhileStatement statement)