Groovy 2.2.0

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, String sourceFile)

 
Method Summary
boolean addInnerClass(ClassNode innerClass)

static int argumentSize(Expression arguments)

static boolean containsSpreadExpression(Expression arguments)

protected void createInterfaceSyntheticStaticFields()

protected void createSyntheticStaticFields()

void despreadList(List expressions, boolean wrap)

protected boolean emptyArguments(Expression arguments)

protected CompileUnit getCompileUnit()

WriterController getController()

SourceUnit getSourceUnit()

static boolean isNullConstant(Expression expr)

static boolean isThisExpression(Expression expression)

void loadInstanceField(FieldExpression fldExp)

void loadStaticField(FieldExpression fldExp)

protected void loadThisOrOwner()

void loadWrapper(Expression argument)

void onLineNumber(ASTNode statement, String message)

void throwException(String s)

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 block)

void visitBooleanExpression(BooleanExpression expression)

void visitBreakStatement(BreakStatement statement)

void visitBytecodeExpression(BytecodeExpression cle)

void visitBytecodeSequence(BytecodeSequence bytecodeSequence)

void visitCaseStatement(CaseStatement statement)

void visitCastExpression(CastExpression castExpression)

void visitCatchStatement(CatchStatement statement)

void visitClass(ClassNode classNode)

void visitClassExpression(ClassExpression expression)

load class object on stack

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)

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)

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)

return a primitive boolean value of the BooleanExpression.

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 Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, 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, 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()


createSyntheticStaticFields

protected void createSyntheticStaticFields()


despreadList

public void despreadList(List expressions, boolean wrap)


emptyArguments

protected boolean emptyArguments(Expression arguments)


getCompileUnit

protected CompileUnit getCompileUnit()


getController

public WriterController getController()


getSourceUnit

public SourceUnit getSourceUnit()


isNullConstant

public static boolean isNullConstant(Expression expr)


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, String message)


throwException

public void throwException(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)


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)


visitCaseStatement

public void visitCaseStatement(CaseStatement statement)


visitCastExpression

public void visitCastExpression(CastExpression castExpression)


visitCatchStatement

@Overridecontroller.getStatementWriter().writeSwitch(statement);
public void visitCatchStatement(CatchStatement statement)


visitClass

public void visitClass(ClassNode classNode)


visitClassExpression

public void visitClassExpression(ClassExpression expression)
load class object on stack


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)


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)


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)
return a primitive boolean value of the BooleanExpression.
Parameters:
expression


visitUnaryPlusExpression

public void visitUnaryPlusExpression(UnaryPlusExpression expression)


visitVariableExpression

public void visitVariableExpression(VariableExpression expression)


visitWhileLoop

public void visitWhileLoop(WhileStatement loop)


 

Copyright © 2003-2013 The Codehaus. All rights reserved.