|
|||||
FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A helper class for bytecode generation with AsmClassGenerator.
Field Summary | |
---|---|
MethodVisitor |
mv
|
Constructor Summary | |
BytecodeHelper(MethodVisitor mv)
|
Method Summary | |
---|---|
static void |
addSubTypes(StringBuffer ret, def types, String start, String end)
|
void |
box(Class type)
Generates the bytecode to autobox the current value on the stack |
void |
box(ClassNode type)
|
void |
boxBoolean()
convert boolean to Boolean |
static ClassNode |
boxOnPrimitive(ClassNode type)
|
void |
doCast(Class type)
|
void |
doCast(ClassNode type)
|
void |
doReturn(ClassNode returnType)
|
void |
dup()
|
static String |
formatNameForClassLoading(String name)
returns a name that Class.forName() can take. |
static String |
getClassInternalName(ClassNode t)
|
static String |
getClassInternalName(Class t)
|
static String |
getClassInternalName(String name)
|
static def |
getClassInternalNames(def names)
|
static String |
getClassLoadingTypeDescription(ClassNode c)
array types are special: eg.: String[]: classname: [Ljava.lang.String; Object: classname: java.lang.Object int[] : classname: [I unlike getTypeDescription '.' is not replaced by '/'. |
static String |
getGenericsBounds(ClassNode type)
|
static String |
getGenericsMethodSignature(MethodNode node)
|
static String |
getGenericsSignature(ClassNode node)
|
static void |
getGenericsTypeSpec(StringBuffer ret, def genericsTypes)
|
static String |
getMethodDescriptor(ClassNode returnType, def parameters)
|
static String |
getMethodDescriptor(Class returnType, def paramTypes)
|
MethodVisitor |
getMethodVisitor()
|
static String |
getTypeDescription(Class c)
|
static String |
getTypeDescription(ClassNode c)
array types are special: eg.: String[]: classname: [Ljava/lang/String; int[]: [I |
static String |
getTypeDescription(ClassNode c, boolean end)
array types are special: eg.: String[]: classname: [Ljava/lang/String; int[]: [I |
static boolean |
hasGenerics(def param)
|
void |
load(ClassNode type, int idx)
|
void |
load(Variable v)
|
void |
loadConstant(Object value)
load the constant on the operand stack. primitives auto-boxed. |
void |
loadVar(Variable variable)
load the value of the variable on the operand stack. unbox it if it's a reference |
void |
mark(String msg)
load a message on the stack and remove it right away. |
void |
negateBoolean()
negate a boolean on stack. true->false, false->true |
void |
pushConstant(boolean value)
|
void |
pushConstant(int value)
|
void |
putField(FieldNode fld)
|
void |
putField(FieldNode fld, String ownerName)
|
void |
quickBoxIfNecessary(ClassNode type)
box the primitive value on the stack |
void |
quickUnboxIfNecessary(ClassNode type)
|
void |
store(Variable v, boolean markStart)
|
void |
store(Variable v)
|
void |
storeVar(Variable variable)
|
void |
swapObjectWith(ClassNode type)
|
void |
swapWithObject(ClassNode type)
|
void |
unbox(Class type)
Generates the bytecode to unbox the current value on the stack |
void |
unbox(ClassNode type)
|
static boolean |
usesGenericsInClassSignature(ClassNode node)
|
static void |
writeGenericsBoundType(StringBuffer ret, ClassNode printType, boolean writeInterfaceMarker)
|
static void |
writeGenericsBounds(StringBuffer ret, GenericsType type, boolean writeInterfaceMarker)
|
Constructor Detail |
---|
public BytecodeHelper(MethodVisitor mv)
Method Detail |
---|
static void addSubTypes(StringBuffer ret, def types, String start, String end)
public void box(Class type)
public void box(ClassNode type)
public void boxBoolean()
public static ClassNode boxOnPrimitive(ClassNode type)
public void doCast(Class type)
public void doCast(ClassNode type)
public void doReturn(ClassNode returnType)
public void dup()
public static String formatNameForClassLoading(String name)
public static String getClassInternalName(ClassNode t)
public static String getClassInternalName(Class t)
public static String getClassInternalName(String name)
public static def getClassInternalNames(def names)
public static String getClassLoadingTypeDescription(ClassNode c)
public static String getGenericsBounds(ClassNode type)
public static String getGenericsMethodSignature(MethodNode node)
public static String getGenericsSignature(ClassNode node)
static void getGenericsTypeSpec(StringBuffer ret, def genericsTypes)
public static String getMethodDescriptor(ClassNode returnType, def parameters)
public static String getMethodDescriptor(Class returnType, def paramTypes)
public MethodVisitor getMethodVisitor()
public static String getTypeDescription(Class c)
public static String getTypeDescription(ClassNode c)
static String getTypeDescription(ClassNode c, boolean end)
static boolean hasGenerics(def param)
public void load(ClassNode type, int idx)
public void load(Variable v)
public void loadConstant(Object value)
public void loadVar(Variable variable)
public void mark(String msg)
public void negateBoolean()
void pushConstant(boolean value)
public void pushConstant(int value)
public void putField(FieldNode fld)
public void putField(FieldNode fld, String ownerName)
public void quickBoxIfNecessary(ClassNode type)
public void quickUnboxIfNecessary(ClassNode type)
public void store(Variable v, boolean markStart)
public void store(Variable v)
public void storeVar(Variable variable)
public void swapObjectWith(ClassNode type)
public void swapWithObject(ClassNode type)
public void unbox(Class type)
public void unbox(ClassNode type)
static boolean usesGenericsInClassSignature(ClassNode node)
static void writeGenericsBoundType(StringBuffer ret, ClassNode printType, boolean writeInterfaceMarker)
static void writeGenericsBounds(StringBuffer ret, GenericsType type, boolean writeInterfaceMarker)