Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.classgen
[Java] Class AsmClassGenerator

    java.lang.Object
      org.codehaus.groovy.ast.CodeVisitorSupport
          org.codehaus.groovy.ast.ClassCodeVisitorSupport
              org.codehaus.groovy.classgen.ClassGenerator
                  org.codehaus.groovy.classgen.AsmClassGenerator

    public class AsmClassGenerator
    extends ClassGenerator

Generates Java class versions of Groovy classes using ASM.

Authors:
  James Strachan
  Bing Ran
  Jochen Theodorou
  Alex Popescu
  Alex Tkachman

Version:
  \$Revision\$

Field Summary
`static boolean` | `ASM_DEBUG`
`static boolean` | `CREATE_DEBUG_INFO`
`static boolean` | `CREATE_LINE_NUMBER_INFO`
`static MethodCallerMultiAdapter` | `getField`
`static MethodCallerMultiAdapter` | `getGroovyObjectField`
`static MethodCallerMultiAdapter` | `setProperty`

Fields inherited from class ClassGenerator
innerClasses

Constructor Summary
`AsmClassGenerator(SourceUnit source, GeneratorContext context, org.objectweb.asm.ClassVisitor classVisitor, java.lang.String sourceFile)`

Method Summary
`boolean` | `addInnerClass(ClassNode innerClass)`
`static int` | `argumentSize(Expression arguments)`
`static boolean` | `containsSpreadExpression(Expression arguments)`
`protected void` | `createInterfaceSyntheticStaticFields()` load class object on stack
`protected void` | `createSyntheticStaticFields()`
`void` | `despreadList(java.util.List expressions, boolean wrap)`
`protected boolean` | `emptyArguments(Expression arguments)`
`protected CompileUnit` | `getCompileUnit()`
`WriterController` | `getController()`
`SourceUnit` | `getSourceUnit()`
`static boolean` | `isThisExpression(Expression expression)`
`void` | `loadInstanceField(FieldExpression fldExp)`
`void` | `loadStaticField(FieldExpression fldExp)`
`protected void` | `loadThisOrOwner()`
`void` | `loadWrapper(Expression argument)`
`void` | `onLineNumber(ASTNode statement, java.lang.String message)`
`void` | `throwException(java.lang.String s)`
`void` | `visitAnnotations(AnnotatedNode node)`
`void` | `visitArgumentlistExpression(ArgumentListExpression ale)`
`void` | `visitArrayExpression(ArrayExpression expression)`
`void` | `visitAssertStatement(AssertStatement statement)`
`void` | `visitAttributeExpression(AttributeExpression expression)` RHS instance field. should move most of the code in the BytecodeHelper
`void` | `visitBinaryExpression(BinaryExpression expression)`
`void` | `visitBitwiseNegationExpression(BitwiseNegationExpression expression)`
`void` | `visitBlockStatement(BlockStatement block)`
`void` | `visitBooleanExpression(BooleanExpression expression)`
`void` | `visitBreakStatement(BreakStatement statement)`
`void` | `visitBytecodeExpression(BytecodeExpression cle)`
`void` | `visitBytecodeSequence(BytecodeSequence bytecodeSequence)` Note: ignore it.
`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)`
`void` | `visitConstructor(ConstructorNode node)`
`void` | `visitConstructorCallExpression(ConstructorCallExpression call)`
`protected void` | `visitConstructorOrMethod(MethodNode node, boolean isConstructor)`
`void` | `visitContinueStatement(ContinueStatement statement)`
`void` | `visitDeclarationExpression(DeclarationExpression expression)` Loads either this object or if we're inside a closure then load the top level owner
`void` | `visitDoWhileLoop(DoWhileStatement loop)`
`void` | `visitExpressionStatement(ExpressionStatement statement)`
`void` | `visitField(FieldNode fieldNode)`
`void` | `visitFieldExpression(FieldExpression expression)`
`void` | `visitForLoop(ForStatement loop)`
`void` | `visitGStringExpression(GStringExpression expression)`
`void` | `visitGenericType(GenericsType genericsType)`
`void` | `visitIfElse(IfStatement ifElse)`
`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` | `visitNotExpression(NotExpression expression)`
`void` | `visitPostfixExpression(PostfixExpression expression)`
`void` | `visitPrefixExpression(PrefixExpression expression)`
`void` | `visitProperty(PropertyNode statement)`
`void` | `visitPropertyExpression(PropertyExpression expression)` @param fldExp
`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 loop)`

Methods inherited from class ClassGenerator
getInnerClasses, getSourceUnit, visitBytecodeSequence

Methods inherited from class ClassCodeVisitorSupport
addError, getSourceUnit, 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

Methods inherited from class CodeVisitorSupport
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, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### ASM_DEBUG

    public static final boolean ASM_DEBUG

### CREATE_DEBUG_INFO

    public static final boolean CREATE_DEBUG_INFO

### CREATE_LINE_NUMBER_INFO

    public static final boolean CREATE_LINE_NUMBER_INFO

### getField

    public static final MethodCallerMultiAdapter getField

### getGroovyObjectField

    public static final MethodCallerMultiAdapter getGroovyObjectField

### setProperty

    public static final MethodCallerMultiAdapter setProperty

Constructor Detail

### AsmClassGenerator

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

Method Detail

### addInnerClass

    public boolean addInnerClass(ClassNode innerClass)

### argumentSize

    public static int argumentSize(Expression arguments)

### containsSpreadExpression

    public static boolean containsSpreadExpression(Expression arguments)

### createInterfaceSyntheticStaticFields

    protected void createInterfaceSyntheticStaticFields()

  load class object on stack

### createSyntheticStaticFields

    protected void createSyntheticStaticFields()

### despreadList

    public void despreadList(java.util.List expressions, boolean wrap)

### emptyArguments

    protected boolean emptyArguments(Expression arguments)

### getCompileUnit

    protected CompileUnit getCompileUnit()

### getController

    public WriterController getController()

### getSourceUnit

    public SourceUnit getSourceUnit()

### isThisExpression

    public static boolean isThisExpression(Expression expression)

### loadInstanceField

    public void loadInstanceField(FieldExpression fldExp)

### loadStaticField

    public void loadStaticField(FieldExpression fldExp)

### loadThisOrOwner

    protected void loadThisOrOwner()

### loadWrapper

    public void loadWrapper(Expression argument)

### onLineNumber

    public void onLineNumber(ASTNode statement, java.lang.String message)

### throwException

    public void throwException(java.lang.String s)

### visitAnnotations

    public void visitAnnotations(AnnotatedNode node)

### visitArgumentlistExpression

    public void visitArgumentlistExpression(ArgumentListExpression ale)

### visitArrayExpression

    public void visitArrayExpression(ArrayExpression expression)

### visitAssertStatement

    public void visitAssertStatement(AssertStatement statement)

### visitAttributeExpression

    public void visitAttributeExpression(AttributeExpression expression)

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

### visitBinaryExpression

    public void visitBinaryExpression(BinaryExpression expression)

### visitBitwiseNegationExpression

    public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)

### visitBlockStatement

    public void visitBlockStatement(BlockStatement block)

### visitBooleanExpression

    public void visitBooleanExpression(BooleanExpression expression)

### visitBreakStatement

    public void visitBreakStatement(BreakStatement statement)

### visitBytecodeExpression

    public void visitBytecodeExpression(BytecodeExpression cle)

### visitBytecodeSequence

    public void visitBytecodeSequence(BytecodeSequence bytecodeSequence)

  Note: ignore it. Annotation generation needs the current visitor.

### visitCaseStatement

    public void visitCaseStatement(CaseStatement statement)

### visitCastExpression

    public void visitCastExpression(CastExpression castExpression)

### visitCatchStatement

    controller.getStatementWriter().writeTryCatchFinally(statement);
    public void visitCatchStatement(CatchStatement statement)

### visitClass

    public void visitClass(ClassNode classNode)

### visitClassExpression

    public void visitClassExpression(ClassExpression expression)

### visitClosureExpression

    public void visitClosureExpression(ClosureExpression expression)

### visitClosureListExpression

    public void visitClosureListExpression(ClosureListExpression expression)

### visitConstantExpression

    public void visitConstantExpression(ConstantExpression expression)

### visitConstructor

    public void visitConstructor(ConstructorNode node)

### visitConstructorCallExpression

    public void visitConstructorCallExpression(ConstructorCallExpression call)

### visitConstructorOrMethod

    protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)

### visitContinueStatement

    public void visitContinueStatement(ContinueStatement statement)

### visitDeclarationExpression

    public void visitDeclarationExpression(DeclarationExpression expression)

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

### visitDoWhileLoop

    public void visitDoWhileLoop(DoWhileStatement loop)

### visitExpressionStatement

    public void visitExpressionStatement(ExpressionStatement statement)

### visitField

    public void visitField(FieldNode fieldNode)

### visitFieldExpression

    public void visitFieldExpression(FieldExpression expression)

### visitForLoop

    public void visitForLoop(ForStatement loop)

### visitGStringExpression

    public void visitGStringExpression(GStringExpression expression)

### visitGenericType

    public void visitGenericType(GenericsType genericsType)

### visitIfElse

    public void visitIfElse(IfStatement ifElse)

### visitListExpression

    public void visitListExpression(ListExpression expression)

### visitMapEntryExpression

    public void visitMapEntryExpression(MapEntryExpression expression)

### visitMapExpression

    public void visitMapExpression(MapExpression expression)

### visitMethod

    public void visitMethod(MethodNode node)

### visitMethodCallExpression

    public void visitMethodCallExpression(MethodCallExpression call)

### visitMethodPointerExpression

    public void visitMethodPointerExpression(MethodPointerExpression expression)

### visitNotExpression

    public void visitNotExpression(NotExpression expression)

### visitPostfixExpression

    public void visitPostfixExpression(PostfixExpression expression)

### visitPrefixExpression

    public void visitPrefixExpression(PrefixExpression expression)

### visitProperty

    public void visitProperty(PropertyNode statement)

### visitPropertyExpression

    public void visitPropertyExpression(PropertyExpression expression)

  Parameters:
    fldExp

### visitRangeExpression

    public void visitRangeExpression(RangeExpression expression)

### visitReturnStatement

    public void visitReturnStatement(ReturnStatement statement)

### visitSpreadExpression

    public void visitSpreadExpression(SpreadExpression expression)

### visitSpreadMapExpression

    public void visitSpreadMapExpression(SpreadMapExpression expression)

### visitStatement

    protected void visitStatement(Statement statement)

### visitStaticMethodCallExpression

    public void visitStaticMethodCallExpression(StaticMethodCallExpression call)

### visitSwitch

    public void visitSwitch(SwitchStatement statement)

### visitSynchronizedStatement

    public void visitSynchronizedStatement(SynchronizedStatement statement)

### visitTernaryExpression

    public void visitTernaryExpression(TernaryExpression expression)

### visitThrowStatement

    public void visitThrowStatement(ThrowStatement statement)

### visitTryCatchFinally

    public void visitTryCatchFinally(TryCatchStatement statement)

### visitTupleExpression

    public void visitTupleExpression(TupleExpression expression)

### visitUnaryMinusExpression

    public void visitUnaryMinusExpression(UnaryMinusExpression expression)

### visitUnaryPlusExpression

    public void visitUnaryPlusExpression(UnaryPlusExpression expression)

### visitVariableExpression

    public void visitVariableExpression(VariableExpression expression)

### visitWhileLoop

    public void visitWhileLoop(WhileStatement loop)

Groovy Documentation