|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.classgen.ClassGenerator
org.codehaus.groovy.classgen.AsmClassGenerator
public class AsmClassGenerator
Generates Java class versions of Groovy classes using ASM.
Field Summary | |
---|---|
static boolean |
ASM_DEBUG
|
static boolean |
CREATE_DEBUG_INFO
|
static boolean |
CREATE_LINE_NUMBER_INFO
|
Fields inherited from class org.codehaus.groovy.classgen.ClassGenerator |
---|
asmJDKVersion, classLoader, innerClasses |
Fields inherited from interface org.objectweb.asm.Opcodes |
---|
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEDYNAMIC_OWNER, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7 |
Constructor Summary | |
---|---|
AsmClassGenerator(SourceUnit source,
GeneratorContext context,
org.objectweb.asm.ClassVisitor classVisitor,
ClassLoader classLoader,
String sourceFile)
|
Methods inherited from class org.codehaus.groovy.classgen.ClassGenerator |
---|
getClassLoader, getInnerClasses |
Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport |
---|
addError, visitCatchStatement, visitClassCodeContainer, visitImports, visitPackage |
Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport |
---|
visitEmptyStatement, visitListOfExpressions, visitShortTernaryExpression |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean CREATE_DEBUG_INFO
public static final boolean CREATE_LINE_NUMBER_INFO
public static final boolean ASM_DEBUG
Constructor Detail |
---|
public AsmClassGenerator(SourceUnit source, GeneratorContext context, org.objectweb.asm.ClassVisitor classVisitor, ClassLoader classLoader, String sourceFile)
Method Detail |
---|
protected SourceUnit getSourceUnit()
getSourceUnit
in class ClassGenerator
public void visitClass(ClassNode classNode)
visitClass
in interface GroovyClassVisitor
visitClass
in class ClassCodeVisitorSupport
public void visitGenericType(GenericsType genericsType)
public static String getMopMethodName(MethodNode method, boolean useThis)
method
- the method to be called by the mop methoduseThis
- if true, then it is a call on "this", "super" else
public static boolean isMopMethod(String methodName)
methodName
- name of the method to test
protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)
visitConstructorOrMethod
in class ClassCodeVisitorSupport
public void visitConstructor(ConstructorNode node)
visitConstructor
in interface GroovyClassVisitor
visitConstructor
in class ClassCodeVisitorSupport
public void visitMethod(MethodNode node)
visitMethod
in interface GroovyClassVisitor
visitMethod
in class ClassCodeVisitorSupport
public void visitField(FieldNode fieldNode)
visitField
in interface GroovyClassVisitor
visitField
in class ClassCodeVisitorSupport
public void visitProperty(PropertyNode statement)
visitProperty
in interface GroovyClassVisitor
visitProperty
in class ClassCodeVisitorSupport
protected void visitStatement(Statement statement)
visitStatement
in class ClassCodeVisitorSupport
public void visitBlockStatement(BlockStatement block)
visitBlockStatement
in interface GroovyCodeVisitor
visitBlockStatement
in class ClassCodeVisitorSupport
public void visitForLoop(ForStatement loop)
visitForLoop
in interface GroovyCodeVisitor
visitForLoop
in class ClassCodeVisitorSupport
public void visitWhileLoop(WhileStatement loop)
visitWhileLoop
in interface GroovyCodeVisitor
visitWhileLoop
in class ClassCodeVisitorSupport
public void visitDoWhileLoop(DoWhileStatement loop)
visitDoWhileLoop
in interface GroovyCodeVisitor
visitDoWhileLoop
in class ClassCodeVisitorSupport
public void visitIfElse(IfStatement ifElse)
visitIfElse
in interface GroovyCodeVisitor
visitIfElse
in class ClassCodeVisitorSupport
public void visitTernaryExpression(TernaryExpression expression)
visitTernaryExpression
in interface GroovyCodeVisitor
visitTernaryExpression
in class CodeVisitorSupport
public void visitAssertStatement(AssertStatement statement)
visitAssertStatement
in interface GroovyCodeVisitor
visitAssertStatement
in class ClassCodeVisitorSupport
public void visitTryCatchFinally(TryCatchStatement statement)
visitTryCatchFinally
in interface GroovyCodeVisitor
visitTryCatchFinally
in class ClassCodeVisitorSupport
public void visitSwitch(SwitchStatement statement)
visitSwitch
in interface GroovyCodeVisitor
visitSwitch
in class ClassCodeVisitorSupport
public void visitCaseStatement(CaseStatement statement)
visitCaseStatement
in interface GroovyCodeVisitor
visitCaseStatement
in class ClassCodeVisitorSupport
public void visitCaseStatement(CaseStatement statement, int switchVariableIndex, org.objectweb.asm.Label thisLabel, org.objectweb.asm.Label nextLabel)
public void visitBreakStatement(BreakStatement statement)
visitBreakStatement
in interface GroovyCodeVisitor
visitBreakStatement
in class ClassCodeVisitorSupport
public void visitContinueStatement(ContinueStatement statement)
visitContinueStatement
in interface GroovyCodeVisitor
visitContinueStatement
in class ClassCodeVisitorSupport
public void visitSynchronizedStatement(SynchronizedStatement statement)
visitSynchronizedStatement
in interface GroovyCodeVisitor
visitSynchronizedStatement
in class ClassCodeVisitorSupport
public void visitThrowStatement(ThrowStatement statement)
visitThrowStatement
in interface GroovyCodeVisitor
visitThrowStatement
in class ClassCodeVisitorSupport
public void visitReturnStatement(ReturnStatement statement)
visitReturnStatement
in interface GroovyCodeVisitor
visitReturnStatement
in class ClassCodeVisitorSupport
protected void doConvertAndCast(ClassNode type, Expression expression, boolean ignoreAutoboxing, boolean forceCast, boolean coerce)
protected void evaluateExpression(Expression expression)
expression
- public void visitExpressionStatement(ExpressionStatement statement)
visitExpressionStatement
in interface GroovyCodeVisitor
visitExpressionStatement
in class ClassCodeVisitorSupport
public void visitDeclarationExpression(DeclarationExpression expression)
visitDeclarationExpression
in interface GroovyCodeVisitor
visitDeclarationExpression
in class CodeVisitorSupport
public void visitBinaryExpression(BinaryExpression expression)
visitBinaryExpression
in interface GroovyCodeVisitor
visitBinaryExpression
in class CodeVisitorSupport
public void visitPostfixExpression(PostfixExpression expression)
visitPostfixExpression
in interface GroovyCodeVisitor
visitPostfixExpression
in class CodeVisitorSupport
public void visitPrefixExpression(PrefixExpression expression)
visitPrefixExpression
in interface GroovyCodeVisitor
visitPrefixExpression
in class CodeVisitorSupport
public void visitClosureExpression(ClosureExpression expression)
visitClosureExpression
in interface GroovyCodeVisitor
visitClosureExpression
in class CodeVisitorSupport
protected void loadThisOrOwner()
public void visitRegexExpression(RegexExpression expression)
visitRegexExpression
in interface GroovyCodeVisitor
visitRegexExpression
in class CodeVisitorSupport
public void visitConstantExpression(ConstantExpression expression)
visitConstantExpression
in interface GroovyCodeVisitor
visitConstantExpression
in class CodeVisitorSupport
public void visitSpreadExpression(SpreadExpression expression)
visitSpreadExpression
in interface GroovyCodeVisitor
visitSpreadExpression
in class CodeVisitorSupport
public void visitSpreadMapExpression(SpreadMapExpression expression)
visitSpreadMapExpression
in interface GroovyCodeVisitor
visitSpreadMapExpression
in class CodeVisitorSupport
public void visitMethodPointerExpression(MethodPointerExpression expression)
visitMethodPointerExpression
in interface GroovyCodeVisitor
visitMethodPointerExpression
in class CodeVisitorSupport
public void visitUnaryMinusExpression(UnaryMinusExpression expression)
visitUnaryMinusExpression
in interface GroovyCodeVisitor
visitUnaryMinusExpression
in class CodeVisitorSupport
public void visitUnaryPlusExpression(UnaryPlusExpression expression)
visitUnaryPlusExpression
in interface GroovyCodeVisitor
visitUnaryPlusExpression
in class CodeVisitorSupport
public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)
visitBitwiseNegationExpression
in interface GroovyCodeVisitor
visitBitwiseNegationExpression
in class CodeVisitorSupport
public void visitCastExpression(CastExpression castExpression)
visitCastExpression
in interface GroovyCodeVisitor
visitCastExpression
in class CodeVisitorSupport
public void visitNotExpression(NotExpression expression)
visitNotExpression
in interface GroovyCodeVisitor
visitNotExpression
in class CodeVisitorSupport
public void visitBooleanExpression(BooleanExpression expression)
visitBooleanExpression
in interface GroovyCodeVisitor
visitBooleanExpression
in class CodeVisitorSupport
expression
- public void visitMethodCallExpression(MethodCallExpression call)
visitMethodCallExpression
in interface GroovyCodeVisitor
visitMethodCallExpression
in class CodeVisitorSupport
protected boolean emptyArguments(Expression arguments)
protected static boolean containsSpreadExpression(Expression arguments)
protected static int argumentSize(Expression arguments)
public void visitStaticMethodCallExpression(StaticMethodCallExpression call)
visitStaticMethodCallExpression
in interface GroovyCodeVisitor
visitStaticMethodCallExpression
in class CodeVisitorSupport
public void visitConstructorCallExpression(ConstructorCallExpression call)
visitConstructorCallExpression
in interface GroovyCodeVisitor
visitConstructorCallExpression
in class CodeVisitorSupport
public void visitPropertyExpression(PropertyExpression expression)
visitPropertyExpression
in interface GroovyCodeVisitor
visitPropertyExpression
in class CodeVisitorSupport
public void visitAttributeExpression(AttributeExpression expression)
visitAttributeExpression
in interface GroovyCodeVisitor
visitAttributeExpression
in class CodeVisitorSupport
protected boolean isGroovyObject(Expression objectExpression)
public void visitFieldExpression(FieldExpression expression)
visitFieldExpression
in interface GroovyCodeVisitor
visitFieldExpression
in class CodeVisitorSupport
public void loadStaticField(FieldExpression fldExp)
fldExp
- public void loadInstanceField(FieldExpression fldExp)
fldExp
- public void storeThisInstanceField(FieldExpression expression)
public void storeStaticField(FieldExpression expression)
protected void visitOuterFieldExpression(FieldExpression expression, ClassNode outerClassNode, int steps, boolean first)
public void visitVariableExpression(VariableExpression expression)
visitVariableExpression
in interface GroovyCodeVisitor
visitVariableExpression
in class ClassCodeVisitorSupport
protected void processStackVariable(Variable variable, boolean useReferenceDirectly)
protected void processClassVariable(String name)
protected void processFieldAccess(String name, FieldNode field, int steps)
protected boolean isInScriptBody()
protected boolean isPopRequired(Expression expression)
protected void createInterfaceSyntheticStaticFields()
protected void createSyntheticStaticFields()
public void visitClassExpression(ClassExpression expression)
visitClassExpression
in interface GroovyCodeVisitor
visitClassExpression
in class CodeVisitorSupport
public void visitRangeExpression(RangeExpression expression)
visitRangeExpression
in interface GroovyCodeVisitor
visitRangeExpression
in class CodeVisitorSupport
public void visitMapEntryExpression(MapEntryExpression expression)
visitMapEntryExpression
in interface GroovyCodeVisitor
visitMapEntryExpression
in class CodeVisitorSupport
public void visitMapExpression(MapExpression expression)
visitMapExpression
in interface GroovyCodeVisitor
visitMapExpression
in class CodeVisitorSupport
public void visitArgumentlistExpression(ArgumentListExpression ale)
visitArgumentlistExpression
in interface GroovyCodeVisitor
visitArgumentlistExpression
in class CodeVisitorSupport
public void visitTupleExpression(TupleExpression expression)
visitTupleExpression
in interface GroovyCodeVisitor
visitTupleExpression
in class CodeVisitorSupport
public void visitArrayExpression(ArrayExpression expression)
visitArrayExpression
in interface GroovyCodeVisitor
visitArrayExpression
in class CodeVisitorSupport
public void visitClosureListExpression(ClosureListExpression expression)
visitClosureListExpression
in interface GroovyCodeVisitor
visitClosureListExpression
in class CodeVisitorSupport
public void visitBytecodeSequence(BytecodeSequence bytecodeSequence)
visitBytecodeSequence
in class ClassGenerator
public void visitListExpression(ListExpression expression)
visitListExpression
in interface GroovyCodeVisitor
visitListExpression
in class CodeVisitorSupport
public void visitGStringExpression(GStringExpression expression)
visitGStringExpression
in interface GroovyCodeVisitor
visitGStringExpression
in class CodeVisitorSupport
public void visitAnnotations(AnnotatedNode node)
visitAnnotations
in class ClassCodeVisitorSupport
protected boolean addInnerClass(ClassNode innerClass)
protected ClassNode createClosureClass(ClosureExpression expression)
protected Parameter[] getClosureSharedVariables(ClosureExpression ce)
protected ClassNode getOutermostClass()
protected void doConvertAndCast(ClassNode type)
protected void doConvertAndCast(ClassNode type, boolean coerce)
protected void evaluateLogicalOrExpression(BinaryExpression expression)
protected void evaluateLogicalAndExpression(BinaryExpression expression)
protected void evaluateBinaryExpression(String method, BinaryExpression expression)
protected void evaluateCompareTo(BinaryExpression expression)
protected void evaluateBinaryExpressionWithAssignment(String method, BinaryExpression expression)
protected void evaluateEqual(BinaryExpression expression, boolean defineVariable)
protected ClassNode getLHSType(Expression leftExpression)
protected boolean isValidTypeForCast(ClassNode type)
public void visitBytecodeExpression(BytecodeExpression cle)
visitBytecodeExpression
in interface GroovyCodeVisitor
visitBytecodeExpression
in class CodeVisitorSupport
protected void visitAndAutoboxBoolean(Expression expression)
protected void evaluatePrefixMethod(String method, Expression expression)
protected void evaluatePostfixMethod(String method, Expression expression)
protected void evaluateInstanceof(BinaryExpression expression)
protected boolean argumentsUseStack(Expression arguments)
protected Expression createReturnLHSExpression(Expression expression)
protected Expression createReusableExpression(Expression expression)
protected boolean isComparisonExpression(Expression expression)
protected void onLineNumber(ASTNode statement, String message)
protected boolean isFieldOrVariable(String name)
protected ClassNode getExpressionType(Expression expression)
protected boolean isInClosureConstructor()
protected boolean isInClosure()
protected boolean isNotExplicitThisInClosure(boolean implicitThis)
protected boolean isStaticMethod()
protected CompileUnit getCompileUnit()
public static boolean usesSuper(MethodCallExpression call)
public static boolean usesSuper(PropertyExpression pe)
protected int getBytecodeVersion()
|
Copyright © 2003-2009 The Codehaus. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |