Top Inners Fields Constructors Methods
javassist.compiler

public Class MemberCodeGen

extends CodeGen
Class Inheritance
Known Direct Subclasses
javassist.compiler.JvstCodeGen
Imports
java.util.ArrayList, .List, javassist.ClassPool, .CtClass, .CtField, .CtMethod, .Modifier, .NotFoundException, javassist.bytecode.AccessFlag, .Bytecode, .ClassFile, .ConstPool, .Descriptor, .FieldInfo, .MethodInfo, .Opcode, javassist.compiler.ast.ASTList, .ASTree, .ArrayInit, .CallExpr, .Declarator, .Expr, .Keyword, .Member, .MethodDecl, .NewExpr, .Pair, .Stmnt, .Symbol

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
protected MemberResolver
protected boolean
protected CtClass
protected MethodInfo
Inherited from javassist.compiler.CodeGen:
arrayDimbinOpbreakListbytecodeclassNamecontinueListexprTypehasReturnedinStaticMethodjavaLangObjectjavaLangStringjvmJavaLangObjectjvmJavaLangStringreturnHookstypeChecker

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private int
private void
addFinally(List<int[]> returnList, Stmnt finallyBlock)

Adds a finally clause for earch return statement.

public void
private void
protected void
atArrayVariableAssign(ArrayInit init, int varType, int varArray, String varClass)

Implements abstract javassist.compiler.CodeGen.atArrayVariableAssign.

public void
protected void
protected void
atFieldAssign(Expr expr, int op, ASTree left, ASTree right, boolean doDup)

Implements abstract javassist.compiler.CodeGen.atFieldAssign.

private void
atFieldAssignCore(CtField f, boolean is_static, int fi, boolean is2byte)

protected void
atFieldPlusPlus(int token, boolean isPost, ASTree oprand, Expr expr, boolean doDup)

Implements abstract javassist.compiler.CodeGen.atFieldPlusPlus.

protected void
private int
atFieldRead(CtField f, boolean isStatic)

Generates bytecode for reading a field value.

public void
public void
atMethodArgs(ASTList args, int[] types, int[] dims, String[] cnames)

public void
atMethodCallCore(CtClass targetClass, String mname, ASTList args, boolean isStatic, boolean isSpecial, int aload0pos, MemberResolver.Method found)

private void
atMethodCallCore2(CtClass targetClass, String mname, boolean isStatic, boolean isSpecial, int aload0pos, MemberResolver.Method found)

protected void
atMultiNewArray(int type, ASTList classname, ASTList size)

public void
private void
atNewArrayExpr2(int type, ASTree sizeExpr, String jvmClassname, ArrayInit init)

public void
protected void
private static void
private static void
private static void
protected CtField
fieldAccess(ASTree expr, boolean acceptLength)

protected String
protected String
getAccessiblePrivate(String methodName, String desc, String newDesc, MethodInfo minfo, CtClass declClass)

public int
getMajorVersion()

Returns the major version of the class file targeted by this compilation.

public int
protected String
getSuperName()

Implements abstract javassist.compiler.CodeGen.getSuperName.

Returns the JVM-internal representation of this super class name.

public CtClass
protected String
getThisName()

Implements abstract javassist.compiler.CodeGen.getThisName.

Returns the JVM-internal representation of this class name.

protected void
private AccessorMaker
isAccessibleField(CtField f, FieldInfo finfo)

Returns null if the field is accessible.

private boolean
isEnclosing(CtClass outer, CtClass inner)

private boolean
public CtClass[]
public CtClass[]
protected String
protected String
private boolean

Returns:

true if the field type is long or double.
setFieldType
(FieldInfo finfo)

Sets exprType, arrayDim, and className.

pack-priv void
setReturnType(String desc, boolean isStatic, boolean popTarget)

public void
setThisMethod(CtMethod m)

Records the currently compiled method.

Inherited from javassist.compiler.CodeGen:
arrayAccessatArrayPlusPlusatArrayReadatAssignCoreatAssignExpratAssignExpratASTListatBinExpratCastExpratClassObjectatCondExpratDeclaratoratDoubleConstatExpratFieldDeclatInstanceOfExpratIntConstatKeywordatMethodBodyatMethodDeclatNumCastExpratPairatPlusPlusCoreatReturnStmntatReturnStmnt2atStmntatStringLatSymbolatVariablebadAssignbadTypebadTypescompileBooleanExprcompileExprdoTypeCheckfatalgetArrayReadOpgetArrayWriteOpgetCompOperatorgetLocalVargetMaxLocalsgetTempVarincMaxLocalsis2wordisP_INTisRefTypelookupBinOppatchGotorightIsStrongsetMaxLocalssetTypeCheckertoJvmArrayNametoJvmTypeName

Field Detail

resolverback to summary
protected MemberResolver resolver
resultStaticback to summary
protected boolean resultStatic
thisClassback to summary
protected CtClass thisClass
thisMethodback to summary
protected MethodInfo thisMethod

Constructor Detail

MemberCodeGenback to summary
public MemberCodeGen(Bytecode b, CtClass cc, ClassPool cp)

Method Detail

addFieldrefInfoback to summary
private int addFieldrefInfo(CtField f, FieldInfo finfo)
addFinallyback to summary
private void addFinally(List<int[]> returnList, Stmnt finallyBlock) throws CompileError

Adds a finally clause for earch return statement.

atArrayInitback to summary
public void atArrayInit(ArrayInit init) throws CompileError

Implements abstract javassist.compiler.CodeGen.atArrayInit.

Annotations
@Override
atArrayLengthback to summary
private void atArrayLength(ASTree expr) throws CompileError
atArrayVariableAssignback to summary
protected void atArrayVariableAssign(ArrayInit init, int varType, int varArray, String varClass) throws CompileError

Implements abstract javassist.compiler.CodeGen.atArrayVariableAssign.

Annotations
@Override
atCallExprback to summary
public void atCallExpr(CallExpr expr) throws CompileError

Implements abstract javassist.compiler.CodeGen.atCallExpr.

Annotations
@Override
atClassObject2back to summary
protected void atClassObject2(String cname) throws CompileError

Overrides javassist.compiler.CodeGen.atClassObject2.

Annotations
@Override
atFieldAssignback to summary
protected void atFieldAssign(Expr expr, int op, ASTree left, ASTree right, boolean doDup) throws CompileError

Implements abstract javassist.compiler.CodeGen.atFieldAssign.

Annotations
@Override
atFieldAssignCoreback to summary
private void atFieldAssignCore(CtField f, boolean is_static, int fi, boolean is2byte) throws CompileError
atFieldPlusPlusback to summary
protected void atFieldPlusPlus(int token, boolean isPost, ASTree oprand, Expr expr, boolean doDup) throws CompileError

Implements abstract javassist.compiler.CodeGen.atFieldPlusPlus.

Annotations
@Override
atFieldReadback to summary
protected void atFieldRead(ASTree expr) throws CompileError

Implements abstract javassist.compiler.CodeGen.atFieldRead.

Annotations
@Override
atFieldReadback to summary
private int atFieldRead(CtField f, boolean isStatic) throws CompileError

Generates bytecode for reading a field value. It returns a fieldref_info index or zero if the field is a private one declared in an enclosing class.

atMemberback to summary
public void atMember(Member mem) throws CompileError

Implements abstract javassist.compiler.CodeGen.atMember.

Annotations
@Override
atMethodArgsback to summary
public void atMethodArgs(ASTList args, int[] types, int[] dims, String[] cnames) throws CompileError
atMethodCallCoreback to summary
public void atMethodCallCore(CtClass targetClass, String mname, ASTList args, boolean isStatic, boolean isSpecial, int aload0pos, MemberResolver.Method found) throws CompileError
atMethodCallCore2back to summary
private void atMethodCallCore2(CtClass targetClass, String mname, boolean isStatic, boolean isSpecial, int aload0pos, MemberResolver.Method found) throws CompileError
atMultiNewArrayback to summary
protected void atMultiNewArray(int type, ASTList classname, ASTList size) throws CompileError
atNewArrayExprback to summary
public void atNewArrayExpr(NewExpr expr) throws CompileError
atNewArrayExpr2back to summary
private void atNewArrayExpr2(int type, ASTree sizeExpr, String jvmClassname, ArrayInit init) throws CompileError
atNewExprback to summary
public void atNewExpr(NewExpr expr) throws CompileError

Implements abstract javassist.compiler.CodeGen.atNewExpr.

Annotations
@Override
atTryStmntback to summary
protected void atTryStmnt(Stmnt st) throws CompileError

Overrides javassist.compiler.CodeGen.atTryStmnt.

Annotations
@Override
badLvalueback to summary
private static void badLvalue() throws CompileError
badMethodback to summary
private static void badMethod() throws CompileError
badNewExprback to summary
private static void badNewExpr() throws CompileError
fieldAccessback to summary
protected CtField fieldAccess(ASTree expr, boolean acceptLength) throws CompileError
getAccessibleConstructorback to summary
protected String getAccessibleConstructor(String desc, CtClass declClass, MethodInfo minfo) throws CompileError
getAccessiblePrivateback to summary
protected String getAccessiblePrivate(String methodName, String desc, String newDesc, MethodInfo minfo, CtClass declClass) throws CompileError
getMajorVersionback to summary
public int getMajorVersion()

Returns the major version of the class file targeted by this compilation.

getMethodArgsLengthback to summary
public int getMethodArgsLength(ASTList args)
getSuperNameback to summary
protected String getSuperName() throws CompileError

Implements abstract javassist.compiler.CodeGen.getSuperName.

Returns the JVM-internal representation of this super class name.

Annotations
@Override
getThisClassback to summary
public CtClass getThisClass()
getThisNameback to summary
protected String getThisName()

Implements abstract javassist.compiler.CodeGen.getThisName.

Returns the JVM-internal representation of this class name.

Annotations
@Override
insertDefaultSuperCallback to summary
protected void insertDefaultSuperCall() throws CompileError

Implements abstract javassist.compiler.CodeGen.insertDefaultSuperCall.

Annotations
@Override
isAccessibleFieldback to summary
private AccessorMaker isAccessibleField(CtField f, FieldInfo finfo) throws CompileError

Returns null if the field is accessible. Otherwise, it throws an exception or it returns AccessorMaker if the field is a private one declared in an enclosing class.

isEnclosingback to summary
private boolean isEnclosing(CtClass outer, CtClass inner)
isFromSameDeclaringClassback to summary
private boolean isFromSameDeclaringClass(CtClass outer, CtClass inner)
makeParamListback to summary
public CtClass[] makeParamList(MethodDecl md) throws CompileError
makeThrowsListback to summary
public CtClass[] makeThrowsList(MethodDecl md) throws CompileError
resolveClassNameback to summary
protected String resolveClassName(ASTList name) throws CompileError

Implements abstract javassist.compiler.CodeGen.resolveClassName.

Annotations
@Override
resolveClassNameback to summary
protected String resolveClassName(String jvmName) throws CompileError

Implements abstract javassist.compiler.CodeGen.resolveClassName.

Annotations
@Override
setFieldTypeback to summary
private boolean setFieldType(FieldInfo finfo) throws CompileError

Sets exprType, arrayDim, and className.

Returns:boolean

true if the field type is long or double.

setReturnTypeback to summary
pack-priv void setReturnType(String desc, boolean isStatic, boolean popTarget) throws CompileError
setThisMethodback to summary
public void setThisMethod(CtMethod m)

Records the currently compiled method.

javassist.compiler back to summary

pack-priv Class MemberCodeGen.JsrHook

extends ReturnHook
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv CodeGen
pack-priv List<int[]>
pack-priv int
Inherited from javassist.compiler.CodeGen.ReturnHook:
next

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected boolean
doit(Bytecode b, int opcode)

Implements abstract javassist.compiler.CodeGen.ReturnHook.doit.

Returns true if the generated code ends with return, throw, or goto.

private int
getVar(int size)

private void
Inherited from javassist.compiler.CodeGen.ReturnHook:
remove

Field Detail

cgenback to summary
pack-priv CodeGen cgen
jsrListback to summary
pack-priv List<int[]> jsrList
varback to summary
pack-priv int var

Constructor Detail

JsrHookback to summary
pack-priv JsrHook(CodeGen gen)

Method Detail

doitback to summary
protected boolean doit(Bytecode b, int opcode)

Implements abstract javassist.compiler.CodeGen.ReturnHook.doit.

Doc from javassist.compiler.CodeGen.ReturnHook.doit.

Returns true if the generated code ends with return, throw, or goto.

Annotations
@Override
getVarback to summary
private int getVar(int size)
jsrJmpback to summary
private void jsrJmp(Bytecode b)
javassist.compiler back to summary

pack-priv Class MemberCodeGen.JsrHook2

extends ReturnHook
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
Inherited from javassist.compiler.CodeGen.ReturnHook:
next

Constructor Summary

AccessConstructor and Description
pack-priv
JsrHook2(CodeGen gen, int[] retTarget)

Method Summary

Modifier and TypeMethod and Description
protected boolean
doit(Bytecode b, int opcode)

Implements abstract javassist.compiler.CodeGen.ReturnHook.doit.

Returns true if the generated code ends with return, throw, or goto.

Inherited from javassist.compiler.CodeGen.ReturnHook:
remove

Field Detail

targetback to summary
pack-priv int target
varback to summary
pack-priv int var

Constructor Detail

JsrHook2back to summary
pack-priv JsrHook2(CodeGen gen, int[] retTarget)

Method Detail

doitback to summary
protected boolean doit(Bytecode b, int opcode)

Implements abstract javassist.compiler.CodeGen.ReturnHook.doit.

Doc from javassist.compiler.CodeGen.ReturnHook.doit.

Returns true if the generated code ends with return, throw, or goto.

Annotations
@Override