|
Groovy 1.7.9 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.classgen.BytecodeHelper
public class BytecodeHelper extends Object
A helper class for bytecode generation with AsmClassGenerator.
Constructor Summary | |
BytecodeHelper(org.objectweb.asm.MethodVisitor mv)
|
Method Summary | |
---|---|
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)
@return the ASM internal name of the type |
static String[]
|
getClassInternalNames(ClassNode[] names)
@return an array of ASM internal names of the type |
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 String
|
getMethodDescriptor(ClassNode returnType, Parameter[] parameters)
@return the ASM method type descriptor |
static String
|
getMethodDescriptor(Class returnType, Class[] paramTypes)
@return the ASM method type descriptor |
org.objectweb.asm.MethodVisitor
|
getMethodVisitor()
|
static String
|
getTypeDescription(Class c)
|
static String
|
getTypeDescription(ClassNode c)
array types are special: eg.: String[]: classname: [Ljava/lang/String; int[]: [I |
void
|
load(ClassNode type, int idx)
|
void
|
load(Variable v)
|
void
|
loadVar(Variable variable)
todo it would be more efficient to generate class constants |
void
|
loadVar(Variable variable, boolean useReferenceDirectly)
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 |
protected 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)
|
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor Detail |
---|
public BytecodeHelper(org.objectweb.asm.MethodVisitor mv)
Method Detail |
---|
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 String[] getClassInternalNames(ClassNode[] 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)
public static String getMethodDescriptor(ClassNode returnType, Parameter[] parameters)
public static String getMethodDescriptor(Class returnType, Class[] paramTypes)
public org.objectweb.asm.MethodVisitor getMethodVisitor()
public static String getTypeDescription(Class c)
public static String getTypeDescription(ClassNode c)
public void load(ClassNode type, int idx)
public void load(Variable v)
public void loadVar(Variable variable)
public void loadVar(Variable variable, boolean useReferenceDirectly)
public void mark(String msg)
public void negateBoolean()
protected 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)
Copyright © 2003-2010 The Codehaus. All rights reserved.