| java.lang.Object com.tc.aspectwerkz.transform.inlining.AsmHelper
Method Summary | |
public static void | addDefaultValue(MethodVisitor cv, Type type) Adds the default value for a type. | public static void | addNullableString(MethodVisitor cv, String value) Adds a string and inserts null if the string is null. | public static void | addReturnStatement(MethodVisitor mv, Type type) Adds the correct return statement. | public static int | calculateClassHash(String declaringType) Calculates the class hash. | public static int | calculateConstructorHash(String desc) Calculates the constructor hash. | public static int | calculateFieldHash(String name, String desc) Calculates the field hash. | public static int | calculateMethodHash(String name, String desc) Calculates the method hash. | public static String | convertArrayTypeName(String typeName) | public static String | convertReflectDescToTypeDesc(String desc) Converts a java reflect type desc to ASM type desc. | public static String | convertTypeDescToReflectDesc(String typeDesc) | public static Class | defineClass(ClassLoader loader, byte[] bytes, String name) Adds a class to a class loader and loads it. | public static void | dumpClass(String dumpDir, String className, byte[] bytes) Dumps an ASM class to disk. | public static void | dumpClass(String dumpDir, String className, ClassWriter cw) Dumps an ASM class to disk. | public static Class | forName(ClassLoader loader, String name) Tries to load a class if unsuccessful returns null. | public static Type[] | getArgumentTypes(Constructor constructor) Gets the argument types for a constructor. | public static Type[] | getArgumentTypes(MethodInfo method) Returns the Java types corresponding to the argument types of the given
method.
Adapted from ASM getArgumentTypes(Method)
Parameters: method - a method. | public static String | getClassDescriptor(ClassInfo c) Returns the descriptor corresponding to the given Java type.
Adapted from ASM Type.getClassDescriptor(Class)
TODO remove the delegation to private method
Parameters: c - an object class, a primitive class or an array class. | public static String | getConstructorDescriptor(ConstructorInfo constructor) Returns the descriptor corresponding to the given constructor info. | public static String | getFieldDescriptor(FieldInfo field) Returns the descriptor corresponding to the given field info. | public static String | getMethodDescriptor(MethodInfo method) Returns the descriptor corresponding to the given method info. | public static int | getRegisterDepth(Type[] typesOnStack) | public static int | getRegisterIndexOf(Type[] typesOnStack, int typeIndex) | public static Type | getType(ClassInfo c) Returns the Java type corresponding to the given class.
Adapted from ASM getType(Class)
Parameters: c - a class. | public static int | getTypeIndexOf(Type[] typesOnStack, int registerIndex) | public static int | incrementIndex(int index, Type type) Increments the index (takes doubles and longs in to account). | public static boolean | isPrimitive(Type returnType) Checks if the Type is a primitive. | public static void | loadArgumentTypes(MethodVisitor mv, Type[] argumentTypes, boolean staticMethod) Loads argument types. | public static void | loadIntegerConstant(MethodVisitor cv, int index) Creates and adds the correct parameter index for integer types. | public static void | loadStringConstant(MethodVisitor cv, String s) Push the string on the stack. | public static int | loadType(MethodVisitor cv, int index, Type type) Loads a type. | public static ClassWriter | newClassWriter(boolean computeMax) | public static void | prepareWrappingOfPrimitiveType(MethodVisitor cv, Type type) Prepares the wrapping or a primitive type. | public static int | storeType(MethodVisitor cv, int index, Type type) Stores a type. | public static void | unwrapType(MethodVisitor cv, Type type) Handles the unwrapping of a type, unboxing of primitives and casting to the correct object type. | public static void | wrapPrimitiveType(MethodVisitor cv, Type type) Handles the wrapping of a primitive type. |
IS_JAVA_5 | final public static boolean IS_JAVA_5(Code) | | A boolean to check if we have a J2SE 5 support
|
JAVA_VERSION | public static int JAVA_VERSION(Code) | | |
addDefaultValue | public static void addDefaultValue(MethodVisitor cv, Type type)(Code) | | Adds the default value for a type.
Parameters: cv - Parameters: type - |
addNullableString | public static void addNullableString(MethodVisitor cv, String value)(Code) | | Adds a string and inserts null if the string is null.
Parameters: cv - Parameters: value - |
addReturnStatement | public static void addReturnStatement(MethodVisitor mv, Type type)(Code) | | Adds the correct return statement.
Parameters: mv - Parameters: type - |
calculateClassHash | public static int calculateClassHash(String declaringType)(Code) | | Calculates the class hash.
Parameters: declaringType - |
calculateConstructorHash | public static int calculateConstructorHash(String desc)(Code) | | Calculates the constructor hash.
Parameters: desc - |
calculateFieldHash | public static int calculateFieldHash(String name, String desc)(Code) | | Calculates the field hash.
Parameters: name - Parameters: desc - |
calculateMethodHash | public static int calculateMethodHash(String name, String desc)(Code) | | Calculates the method hash. The computation MUST be the same as in ReflectHelper, thus we switch back the names
to Java style. Note that for array type, Java.reflect is using "[Lpack.foo;" style unless primitive.
Parameters: name - Parameters: desc - |
convertArrayTypeName | public static String convertArrayTypeName(String typeName)(Code) | | Converts an internal Java array type name ([Lblabla) to the a the format used by the expression matcher
(blabla[])
Parameters: typeName - is type name |
convertReflectDescToTypeDesc | public static String convertReflectDescToTypeDesc(String desc)(Code) | | Converts a java reflect type desc to ASM type desc.
Parameters: desc - |
convertTypeDescToReflectDesc | public static String convertTypeDescToReflectDesc(String typeDesc)(Code) | | Converts an ASM type descriptor" (I, [I, [Ljava/lang/String;, Ljava/lang/String;) to a Java.reflect one (int, [I,
[Ljava.lang.String;, java.lang.String)
Parameters: typeDesc - the Java.reflect string representation |
defineClass | public static Class defineClass(ClassLoader loader, byte[] bytes, String name)(Code) | | Adds a class to a class loader and loads it.
Parameters: loader - the class loader (if null the context class loader will be used) Parameters: bytes - the bytes for the class Parameters: name - the name of the class the class |
forName | public static Class forName(ClassLoader loader, String name)(Code) | | Tries to load a class if unsuccessful returns null.
Parameters: loader - the class loader Parameters: name - the name of the class the class |
getArgumentTypes | public static Type[] getArgumentTypes(Constructor constructor)(Code) | | Gets the argument types for a constructor. Parts of code in this method is taken from the ASM codebase.
Parameters: constructor - the ASM argument types for the constructor |
getArgumentTypes | public static Type[] getArgumentTypes(MethodInfo method)(Code) | | Returns the Java types corresponding to the argument types of the given
method.
Adapted from ASM getArgumentTypes(Method)
Parameters: method - a method. the Java types corresponding to the argument types of the givenmethod. |
getClassDescriptor | public static String getClassDescriptor(ClassInfo c)(Code) | | Returns the descriptor corresponding to the given Java type.
Adapted from ASM Type.getClassDescriptor(Class)
TODO remove the delegation to private method
Parameters: c - an object class, a primitive class or an array class. the descriptor corresponding to the given class. |
getConstructorDescriptor | public static String getConstructorDescriptor(ConstructorInfo constructor)(Code) | | Returns the descriptor corresponding to the given constructor info.
Parameters: constructor - the descriptor of the given constructor. |
getFieldDescriptor | public static String getFieldDescriptor(FieldInfo field)(Code) | | Returns the descriptor corresponding to the given field info.
Parameters: field - the descriptor of the given field. |
getMethodDescriptor | public static String getMethodDescriptor(MethodInfo method)(Code) | | Returns the descriptor corresponding to the given method info.
Adapted from ASM Type.getMethodDescriptor()
Parameters: method - the descriptor of the given method. |
getRegisterDepth | public static int getRegisterDepth(Type[] typesOnStack)(Code) | | Compute the register depth, based on an array of types (long, double = 2 bytes address)
Parameters: typesOnStack - depth of the stack |
getRegisterIndexOf | public static int getRegisterIndexOf(Type[] typesOnStack, int typeIndex)(Code) | | Compute the index on the stack of a given argument based on its index in the signature
Parameters: typesOnStack - Parameters: typeIndex - |
getType | public static Type getType(ClassInfo c)(Code) | | Returns the Java type corresponding to the given class.
Adapted from ASM getType(Class)
Parameters: c - a class. the Java type corresponding to the given class. |
getTypeIndexOf | public static int getTypeIndexOf(Type[] typesOnStack, int registerIndex)(Code) | | Compute the index on the signature of a given argument based on its index as if it was on the stack
where the stack would start at the first argument
Parameters: typesOnStack - Parameters: registerIndex - |
incrementIndex | public static int incrementIndex(int index, Type type)(Code) | | Increments the index (takes doubles and longs in to account).
Parameters: index - Parameters: type - the incremented index |
isPrimitive | public static boolean isPrimitive(Type returnType)(Code) | | Checks if the Type is a primitive.
Parameters: returnType - TRUE/FALSE |
loadArgumentTypes | public static void loadArgumentTypes(MethodVisitor mv, Type[] argumentTypes, boolean staticMethod)(Code) | | Loads argument types.
Parameters: mv - Parameters: argumentTypes - |
loadIntegerConstant | public static void loadIntegerConstant(MethodVisitor cv, int index)(Code) | | Creates and adds the correct parameter index for integer types.
Parameters: cv - Parameters: index - |
loadStringConstant | public static void loadStringConstant(MethodVisitor cv, String s)(Code) | | Push the string on the stack. Deal when case where string is null.
Parameters: cv - Parameters: s - |
loadType | public static int loadType(MethodVisitor cv, int index, Type type)(Code) | | Loads a type.
Parameters: cv - Parameters: index - Parameters: type - the incremented index |
newClassWriter | public static ClassWriter newClassWriter(boolean computeMax)(Code) | | Factory method for ASM ClassWriter and J2SE 5 support
See http://www.objectweb.org/wws/arc/asm/2004-08/msg00005.html
Parameters: computeMax - |
prepareWrappingOfPrimitiveType | public static void prepareWrappingOfPrimitiveType(MethodVisitor cv, Type type)(Code) | | Prepares the wrapping or a primitive type.
Parameters: cv - Parameters: type - |
storeType | public static int storeType(MethodVisitor cv, int index, Type type)(Code) | | Stores a type.
Parameters: cv - Parameters: index - Parameters: type - the incremented index |
unwrapType | public static void unwrapType(MethodVisitor cv, Type type)(Code) | | Handles the unwrapping of a type, unboxing of primitives and casting to the correct object type.
Takes care of null value replaced by default primitive value.
(obj==null)?0L:((Long)obj).longValue();
Parameters: cv - Parameters: type - |
wrapPrimitiveType | public static void wrapPrimitiveType(MethodVisitor cv, Type type)(Code) | | Handles the wrapping of a primitive type.
Parameters: cv - Parameters: type - |
|
|