Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.aspectwerkz.transform.inlining
Class AsmHelper

    java.lang.Object
      org.codehaus.aspectwerkz.transform.inlining.AsmHelper

All Implemented Interfaces:
  TransformationConstants, org.objectweb.asm.Constants

    public class AsmHelper

extends Object
implements TransformationConstants

Helper class with utility methods for the ASM library.

Author:
  Jonas BonŽr , Alexandre Vasseur

Field Summary
`static ClassInfo` | `BOOLEAN`
`static ClassInfo` | `BYTE`
`static ClassInfo` | `CHARACTER`
`static ClassInfo` | `DOUBLE`
`static ClassInfo` | `FLOAT`
`static ClassInfo` | `INTEGER`
`static boolean` | `IS_JAVA_5` A boolean to check if we have a J2SE 5 support
`static int` | `JAVA_VERSION`
`static ClassInfo` | `LONG`
`static ClassInfo` | `SHORT`
`static ClassInfo` | `VOID`

Fields inherited from interface org.codehaus.aspectwerkz.transform.TransformationConstants
`ADD_META_DATA_METHOD_NAME, ADD_META_DATA_METHOD_SIGNATURE, ADVISABLE_CLASS_JAVA_NAME, ADVISABLE_CLASS_NAME, AFTER_ADVICE_ARRAY_CLASS_SIGNATURE, AFTER_ADVICE_CLASS_NAME, AFTER_ADVICE_INVOKE_METHOD_SIGNATURE, AFTER_INTERCEPTORS_FIELD_NAME, AFTER_RETURNING_ADVICE_ARRAY_CLASS_SIGNATURE, AFTER_RETURNING_ADVICE_CLASS_NAME, AFTER_RETURNING_ADVICE_INVOKE_METHOD_SIGNATURE, AFTER_RETURNING_INTERCEPTORS_FIELD_NAME, AFTER_THROWING_ADVICE_ARRAY_CLASS_SIGNATURE, AFTER_THROWING_ADVICE_CLASS_NAME, AFTER_THROWING_ADVICE_INVOKE_METHOD_SIGNATURE, AFTER_THROWING_INTERCEPTORS_FIELD_NAME, ARGUMENT_FIELD, AROUND_ADVICE_ARRAY_CLASS_SIGNATURE, AROUND_ADVICE_CLASS_NAME, AROUND_ADVICE_INVOKE_METHOD_SIGNATURE, AROUND_INTERCEPTORS_FIELD_NAME, ASPECT_FIELD_PREFIX, ASPECT_OF_METHOD_NAME, ASPECT_OF_PER_CLASS_METHOD_SIGNATURE, ASPECT_OF_PER_INSTANCE_METHOD_SIGNATURE, ASPECT_OF_PER_JVM_METHOD_SIGNATURE, ASPECTS_CLASS_NAME, ASPECTWERKZ_PREFIX, BEFORE_ADVICE_ARRAY_CLASS_SIGNATURE, BEFORE_ADVICE_CLASS_NAME, BEFORE_ADVICE_INVOKE_METHOD_SIGNATURE, BEFORE_INTERCEPTORS_FIELD_NAME, BOOLEAN_CLASS_INIT_METHOD_SIGNATURE, BOOLEAN_CLASS_NAME, BOOLEAN_VALUE_METHOD_NAME, BOOLEAN_VALUE_METHOD_SIGNATURE, BYTE_CLASS_INIT_METHOD_SIGNATURE, BYTE_CLASS_NAME, BYTE_VALUE_METHOD_NAME, BYTE_VALUE_METHOD_SIGNATURE, CALLEE_INSTANCE_FIELD_NAME, CALLER_INSTANCE_FIELD_NAME, CHAR_VALUE_METHOD_NAME, CHAR_VALUE_METHOD_SIGNATURE, CHARACTER_CLASS_INIT_METHOD_SIGNATURE, CHARACTER_CLASS_NAME, CLASS_CLASS, CLASS_CLASS_GETCLASSLOADER_METHOD_SIGNATURE, CLASS_CLASS_SIGNATURE, CLASS_LOADER_CLASS_NAME, CLASS_LOADER_REFLECT_CLASS_NAME, CLASS_NOT_FOUND_EXCEPTION_CLASS_NAME, CLINIT_METHOD_NAME, CLINIT_METHOD_SIGNATURE, CONSTRUCTOR_RTTI_IMPL_CLASS_NAME, CONSTRUCTOR_RTTI_IMPL_CLASS_SIGNATURE, CONSTRUCTOR_RTTI_IMPL_INIT_SIGNATURE, CONSTRUCTOR_SIGNATURE_IMPL_CLASS_SIGNATURE, COPY_METHOD_NAME, COPY_METHOD_SIGNATURE, DEFINE_CLASS_METHOD_NAME, DELIMITER, DOUBLE_CLASS_INIT_METHOD_SIGNATURE, DOUBLE_CLASS_NAME, DOUBLE_VALUE_METHOD_NAME, DOUBLE_VALUE_METHOD_SIGNATURE, EMITTED_JOINPOINTS_FIELD_NAME, EMPTY_WRAPPER_ATTRIBUTE_VALUE_EMPTY, EMPTY_WRAPPER_ATTRIBUTE_VALUE_NOTEMPTY, EMTPTY_ARRAY_LIST, ENCLOSING_SJP_FIELD_CLASS_SIGNATURE, ENCLOSING_SJP_FIELD_NAME, FIELD_RTTI_IMPL_CLASS_NAME, FIELD_RTTI_IMPL_CLASS_SIGNATURE, FIELD_RTTI_IMPL_INIT_SIGNATURE, FIELD_SIGNATURE_IMPL_CLASS_SIGNATURE, FLOAT_CLASS_INIT_METHOD_SIGNATURE, FLOAT_CLASS_NAME, FLOAT_VALUE_METHOD_NAME, FLOAT_VALUE_METHOD_SIGNATURE, FOR_NAME_METHOD_NAME, FOR_NAME_METHOD_SIGNATURE, GET_AFTER_ADVICE_METHOD_NAME, GET_AFTER_ADVICE_METHOD_SIGNATURE, GET_AFTER_RETURNING_ADVICE_METHOD_NAME, GET_AFTER_RETURNING_ADVICE_METHOD_SIGNATURE, GET_AFTER_THROWING_ADVICE_METHOD_NAME, GET_AFTER_THROWING_ADVICE_METHOD_SIGNATURE, GET_AROUND_ADVICE_METHOD_NAME, GET_AROUND_ADVICE_METHOD_SIGNATURE, GET_BEFORE_ADVICE_METHOD_NAME, GET_BEFORE_ADVICE_METHOD_SIGNATURE, GET_CALLEE_CLASS_METHOD_NAME, GET_CALLEE_CLASS_METHOD_SIGNATURE, GET_CALLEE_METHOD_NAME, GET_CALLER_CLASS_METHOD_NAME, GET_CALLER_CLASS_METHOD_SIGNATURE, GET_CALLER_METHOD_NAME, GET_CFLOW_STACK_METHOD_NAME, GET_CFLOW_STACK_METHOD_SIGNATURE, GET_ENCLOSING_SJP_METHOD_NAME, GET_ENCLOSING_SJP_METHOD_SIGNATURE, GET_INSTANCE_LEVEL_ASPECT_METHOD_NAME, GET_INSTANCE_LEVEL_ASPECT_METHOD_SIGNATURE, GET_META_DATA_METHOD_NAME, GET_META_DATA_METHOD_SIGNATURE, GET_METHOD_NAME, GET_METHOD_SIGNATURE, GET_RTTI_METHOD_NAME, GET_RTTI_METHOD_SIGNATURE, GET_SIGNATURE_METHOD_NAME, GET_SIGNATURE_METHOD_SIGNATURE, GET_TARGET_CLASS_METHOD_NAME, GET_TARGET_CLASS_METHOD_SIGNATURE, GET_TARGET_METHOD_NAME, GET_THIS_METHOD_NAME, GET_TYPE_METHOD_NAME, GET_TYPE_METHOD_SIGNATURE, GETCLASSLOADER_METHOD_NAME, GETFIELD_WRAPPER_METHOD_PREFIX, HANDLER_RTTI_IMPL_CLASS_NAME, HANDLER_RTTI_IMPL_CLASS_SIGNATURE, HANDLER_RTTI_IMPL_INIT_SIGNATURE, HANDLER_SIGNATURE_IMPL_CLASS_SIGNATURE, HAS_INSTANCE_LEVEL_ASPECT_INTERFACE_NAME, HASH_MAP_CLASS_NAME, I, INDEX_NOTAVAILABLE, INIT_JOIN_POINTS_METHOD_NAME, INIT_METHOD_NAME, INSTANCE_LEVEL_ASPECT_MAP_FIELD_NAME, INSTANCE_LEVEL_ASPECT_MAP_FIELD_SIGNATURE, INT_VALUE_METHOD_NAME, INT_VALUE_METHOD_SIGNATURE, INTEGER_CLASS_INIT_METHOD_SIGNATURE, INTEGER_CLASS_NAME, INTERCEPT_INVOKE_METHOD_NAME, INTERCEPTOR_INDEX_FIELD_NAME, INVOKE_METHOD_NAME, INVOKE_WRAPPER_METHOD_PREFIX, IS_IN_CFLOW_METOD_NAME, IS_IN_CFLOW_METOD_SIGNATURE, JOIN_POINT_CLASS_NAME, JOIN_POINT_CLASS_SIGNATURE, JOIN_POINT_CLASS_SUFFIX, JOIN_POINT_JAVA_CLASS_NAME, JOIN_POINT_MANAGER_CLASS_NAME, L, LOAD_JOIN_POINT_METHOD_NAME, LOAD_JOIN_POINT_METHOD_SIGNATURE, LONG_CLASS_INIT_METHOD_SIGNATURE, LONG_CLASS_NAME, LONG_VALUE_METHOD_NAME, LONG_VALUE_METHOD_SIGNATURE, MAP_CLASS_NAME, MAP_CLASS_SIGNATURE, META_DATA_FIELD_NAME, METHOD_RTTI_IMPL_CLASS_NAME, METHOD_RTTI_IMPL_CLASS_SIGNATURE, METHOD_RTTI_IMPL_INIT_SIGNATURE, METHOD_SIGNATURE_IMPL_CLASS_NAME, METHOD_SIGNATURE_IMPL_CLASS_SIGNATURE, MIXIN_FIELD_NAME, MIXIN_OF_METHOD_NAME, MIXIN_OF_METHOD_PER_CLASS_SIGNATURE, MIXIN_OF_METHOD_PER_INSTANCE_SIGNATURE, MIXIN_OF_METHOD_PER_JVM_SIGNATURE, MIXINS_CLASS_NAME, MODIFIER_INVOKEINTERFACE, NEW_CATCH_CLAUSE_SIGNATURE_METHOD_NAME, NEW_CONSTRUCTOR_SIGNATURE_METHOD_NAME, NEW_CONSTRUCTOR_SIGNATURE_METHOD_SIGNATURE, NEW_ENCLOSING_SJP_METHOD_NAME, NEW_ENCLOSING_SJP_METHOD_SIGNATURE, NEW_FIELD_SIGNATURE_METHOD_NAME, NEW_FIELD_SIGNATURE_METHOD_SIGNATURE, NEW_HANDLER_SIGNATURE_METHOD_SIGNATURE, NEW_METHOD_SIGNATURE_METHOD_NAME, NEW_METHOD_SIGNATURE_METHOD_SIGNATURE, NEW_STATICINITIALIZATION_SIGNATURE_METHOD_NAME, NEW_STATICINITIALIZATION_SIGNATURE_METHOD_SIGNATURE, NO_PARAM_RETURN_VOID_SIGNATURE, NO_PARAMS_RETURN_VOID_METHOD_SIGNATURE, NO_PARAMS_SIGNATURE, NON_OPTIMIZED_JOIN_POINT, NR_OF_AFTER_INTERCEPTORS_FIELD_NAME, NR_OF_AFTER_RETURNING_INTERCEPTORS_FIELD_NAME, NR_OF_AFTER_THROWING_INTERCEPTORS_FIELD_NAME, NR_OF_AROUND_INTERCEPTORS_FIELD_NAME, NR_OF_BEFORE_INTERCEPTORS_FIELD_NAME, OBJECT_CLASS_NAME, OBJECT_CLASS_SIGNATURE, OPTIMIZED_JOIN_POINT, OPTIMIZED_JOIN_POINT_INSTANCE_FIELD_NAME, ORIGINAL_METHOD_PREFIX, PROCEED_METHOD_NAME, PROCEED_METHOD_SIGNATURE, PUT_METHOD_NAME, PUT_METHOD_SIGNATURE, PUTFIELD_WRAPPER_METHOD_PREFIX, RESET_METHOD_NAME, RETURN_VALUE_FIELD_NAME, RUNTIME_EXCEPTION_CLASS_NAME, RUNTIME_EXCEPTION_INIT_METHOD_SIGNATURE, SEMICOLON, SERIAL_VERSION_UID_FIELD_NAME, SET_FIELD_VALUE_METHOD_NAME, SET_FIELD_VALUE_METHOD_SIGNATURE, SET_PARAMETER_VALUE_METHOD_NAME, SET_PARAMETER_VALUE_METHOD_SIGNATURE, SET_PARAMETER_VALUES_METHOD_NAME, SET_PARAMETER_VALUES_METHOD_SIGNATURE, SET_RETURN_VALUE_METHOD_NAME, SET_RETURN_VALUE_METHOD_SIGNATURE, SHORT_CLASS_INIT_METHOD_SIGNATURE, SHORT_CLASS_NAME, SHORT_VALUE_METHOD_NAME, SHORT_VALUE_METHOD_SIGNATURE, SIGNATURE_FACTORY_CLASS, SIGNATURE_FIELD_NAME, STACK_FRAME_COUNTER_FIELD_NAME, STATIC_INITIALIZATION_METHOD_NAME, STATIC_JOIN_POINT_CLASS_NAME, STATIC_JOIN_POINT_JAVA_CLASS_NAME, STATICINITIALIZATION_RTTI_IMPL_CLASS_NAME, STATICINITIALIZATION_RTTI_IMPL_INIT_SIGNATURE, STATICINITIALIZATION_SIGNATURE_IMPL_CLASS_NAME, STATICINITIALIZATION_SIGNATURE_IMPL_CLASS_SIGNATURE, STATICINITIALIZER_WRAPPER_METHOD_KEY, SYNTHETIC_MEMBER_PREFIX, TARGET_CLASS_FIELD_NAME, THROWABLE_CLASS_NAME, WRAPPER_METHOD_PREFIX`

Fields inherited from interface org.objectweb.asm.Constants
`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, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, 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, 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, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, 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, V1_1, V1_2, V1_3, V1_4, V1_5`

Constructor Summary
`AsmHelper()`

Method Summary
`static void` | `addDefaultValue(org.objectweb.asm.CodeVisitor cv, org.objectweb.asm.Type type)` Adds the default value for a type.
`static void` | `addNullableString(org.objectweb.asm.CodeVisitor cv, String value)` Adds a string and inserts null if the string is null.
`static void` | `addReturnStatement(org.objectweb.asm.CodeVisitor mv, org.objectweb.asm.Type type)` Adds the correct return statement.
`static int` | `calculateClassHash(String declaringType)` Calculates the class hash.
`static int` | `calculateConstructorHash(String desc)` Calculates the constructor hash.
`static int` | `calculateFieldHash(String name, String desc)` Calculates the field hash.
`static int` | `calculateMethodHash(String name, String desc)` Calculates the method hash.
`static String` | `convertArrayTypeName(String typeName)` Converts an internal Java array type name ([Lblabla) to the a the format used by the expression matcher (blabla[])
`static String` | `convertReflectDescToTypeDesc(String desc)` Converts a java reflect type desc to ASM type desc.
`static String` | `convertTypeDescToReflectDesc(String typeDesc)` 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)
`static Class` | `defineClass(ClassLoader loader, byte[] bytes, String name)` Adds a class to a class loader and loads it.
`static void` | `dumpClass(String dumpDir, String className, byte[] bytes)` Dumps an ASM class to disk.
`static void` | `dumpClass(String dumpDir, String className, org.objectweb.asm.ClassWriter cw)` Dumps an ASM class to disk.
`static Class` | `forName(ClassLoader loader, String name)` Tries to load a class if unsuccessful returns null.
`static org.objectweb.asm.Type[]` | `getArgumentTypes(Constructor constructor)` Gets the argument types for a constructor.
`static org.objectweb.asm.Type[]` | `getArgumentTypes(MethodInfo method)` Returns the Java types corresponding to the argument types of the given method.
`static String` | `getClassDescriptor(ClassInfo c)` Returns the descriptor corresponding to the given Java type.
`static String` | `getConstructorDescriptor(ConstructorInfo constructor)` Returns the descriptor corresponding to the given constructor info.
`static String` | `getFieldDescriptor(FieldInfo field)` Returns the descriptor corresponding to the given field info.
`static String` | `getMethodDescriptor(MethodInfo method)` Returns the descriptor corresponding to the given method info.
`static int` | `getRegisterDepth(org.objectweb.asm.Type[] typesOnStack)` Compute the register depth, based on an array of types (long, double = 2 bytes address)
`static int` | `getRegisterIndexOf(org.objectweb.asm.Type[] typesOnStack, int typeIndex)` Compute the index on the stack of a given argument based on its index in the signature
`static org.objectweb.asm.Type` | `getType(ClassInfo c)` Returns the Java type corresponding to the given class.
`static int` | `getTypeIndexOf(org.objectweb.asm.Type[] typesOnStack, int registerIndex)` 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
`static int` | `incrementIndex(int index, org.objectweb.asm.Type type)` Increments the index (takes doubles and longs in to account).
`static boolean` | `isPrimitive(org.objectweb.asm.Type returnType)` Checks if the Type is a primitive.
`static void` | `loadArgumentTypes(org.objectweb.asm.CodeVisitor mv, org.objectweb.asm.Type[] argumentTypes, boolean staticMethod)` Loads argument types.
`static void` | `loadIntegerConstant(org.objectweb.asm.CodeVisitor cv, int index)` Creates and adds the correct parameter index for integer types.
`static int` | `loadType(org.objectweb.asm.CodeVisitor cv, int index, org.objectweb.asm.Type type)` Loads a type.
`static org.objectweb.asm.ClassWriter` | `newClassWriter(boolean computeMax)` Factory method for ASM ClassWriter and J2SE 5 support See http://www.objectweb.org/wws/arc/asm/2004-08/msg00005.html
`static void` | `prepareWrappingOfPrimitiveType(org.objectweb.asm.CodeVisitor cv, org.objectweb.asm.Type type)` Prepares the wrapping or a primitive type.
`static int` | `storeType(org.objectweb.asm.CodeVisitor cv, int index, org.objectweb.asm.Type type)` Stores a type.
`static void` | `unwrapType(org.objectweb.asm.CodeVisitor cv, org.objectweb.asm.Type type)` Handles the unwrapping of a type, unboxing of primitives and casting to the correct object type.
`static void` | `wrapPrimitiveType(org.objectweb.asm.CodeVisitor cv, org.objectweb.asm.Type type)` Handles the wrapping of a primitive type.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INTEGER

    public static final ClassInfo INTEGER

### VOID

    public static final ClassInfo VOID

### BOOLEAN

    public static final ClassInfo BOOLEAN

### BYTE

    public static final ClassInfo BYTE

### CHARACTER

    public static final ClassInfo CHARACTER

### SHORT

    public static final ClassInfo SHORT

### DOUBLE

    public static final ClassInfo DOUBLE

### FLOAT

    public static final ClassInfo FLOAT

### LONG

    public static final ClassInfo LONG

### IS_JAVA_5

    public static final boolean IS_JAVA_5

  A boolean to check if we have a J2SE 5 support

### JAVA_VERSION

    public static int JAVA_VERSION

Constructor Detail

### AsmHelper

    public AsmHelper()

Method Detail

### newClassWriter

    public static org.objectweb.asm.ClassWriter newClassWriter(boolean computeMax)

  Factory method for ASM ClassWriter and J2SE 5 support See http://www.objectweb.org/wws/arc/asm/2004-08/msg00005.html

  Parameters:
    `computeMax` -
  Returns:

### getArgumentTypes

    public static org.objectweb.asm.Type[] getArgumentTypes(Constructor constructor)

  Gets the argument types for a constructor.

  Parts of code in this method is taken from the ASM codebase.

  Parameters:
    `constructor` -
  Returns:
    the ASM argument types for the constructor

### dumpClass

    public static void dumpClass(String dumpDir,
                                 String className,
                                 byte[] bytes)
                          throws IOException

  Dumps an ASM class to disk.

  Parameters:
    `dumpDir` -
    `className` -
    `bytes` -
  Throws:
    `IOException`

### dumpClass

    public static void dumpClass(String dumpDir,
                                 String className,
                                 org.objectweb.asm.ClassWriter cw)
                          throws IOException

  Dumps an ASM class to disk.

  Parameters:
    `dumpDir` -
    `className` -
    `cw` -
  Throws:
    `IOException`

### defineClass

    public static Class defineClass(ClassLoader loader,
                                    byte[] bytes,
                                    String name)

  Adds a class to a class loader and loads it.

  Parameters:
    `loader` - the class loader (if null the context class loader will be used)
    `bytes` - the bytes for the class
    `name` - the name of the class
  Returns:
    the class

### forName

    public static Class forName(ClassLoader loader,
                                String name)

  Tries to load a class if unsuccessful returns null.

  Parameters:
    `loader` - the class loader
    `name` - the name of the class
  Returns:
    the class

### calculateMethodHash

    public static int calculateMethodHash(String name,
                                          String desc)

  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` -
    `desc` -
  Returns:

### calculateConstructorHash

    public static int calculateConstructorHash(String desc)

  Calculates the constructor hash.

  Parameters:
    `desc` -
  Returns:

### calculateFieldHash

    public static int calculateFieldHash(String name,
                                         String desc)

  Calculates the field hash.

  Parameters:
    `name` -
    `desc` -
  Returns:

### calculateClassHash

    public static int calculateClassHash(String declaringType)

  Calculates the class hash.

  Parameters:
    `declaringType` -
  Returns:

### convertArrayTypeName

    public static String convertArrayTypeName(String typeName)

  Converts an internal Java array type name ([Lblabla) to the a the format used by the expression matcher (blabla[])

  Parameters:
    `typeName` - is type name
  Returns:

### convertTypeDescToReflectDesc

    public static String convertTypeDescToReflectDesc(String typeDesc)

  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` -
  Returns:
    the Java.reflect string representation

### convertReflectDescToTypeDesc

    public static String convertReflectDescToTypeDesc(String desc)

  Converts a java reflect type desc to ASM type desc.

  Parameters:
    `desc` -
  Returns:

### addReturnStatement

    public static void addReturnStatement(org.objectweb.asm.CodeVisitor mv,
                                          org.objectweb.asm.Type type)

  Adds the correct return statement.

  Parameters:
    `mv` -
    `type` -

### loadArgumentTypes

    public static void loadArgumentTypes(org.objectweb.asm.CodeVisitor mv,
                                         org.objectweb.asm.Type[] argumentTypes,
                                         boolean staticMethod)

  Loads argument types.

  Parameters:
    `mv` -
    `argumentTypes` -

### loadType

    public static int loadType(org.objectweb.asm.CodeVisitor cv,
                               int index,
                               org.objectweb.asm.Type type)

  Loads a type.

  Parameters:
    `cv` -
    `index` -
    `type` -
  Returns:
    the incremented index

### storeType

    public static int storeType(org.objectweb.asm.CodeVisitor cv,
                                int index,
                                org.objectweb.asm.Type type)

  Stores a type.

  Parameters:
    `cv` -
    `index` -
    `type` -
  Returns:
    the incremented index

### loadIntegerConstant

    public static void loadIntegerConstant(org.objectweb.asm.CodeVisitor cv,
                                           int index)

  Creates and adds the correct parameter index for integer types.

  Parameters:
    `cv` -
    `index` -

### prepareWrappingOfPrimitiveType

    public static void prepareWrappingOfPrimitiveType(org.objectweb.asm.CodeVisitor cv,
                                                      org.objectweb.asm.Type type)

  Prepares the wrapping or a primitive type.

  Parameters:
    `cv` -
    `type` -

### wrapPrimitiveType

    public static void wrapPrimitiveType(org.objectweb.asm.CodeVisitor cv,
                                         org.objectweb.asm.Type type)

  Handles the wrapping of a primitive type.

  Parameters:
    `cv` -
    `type` -

### unwrapType

    public static void unwrapType(org.objectweb.asm.CodeVisitor cv,
                                  org.objectweb.asm.Type type)

  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` -
    `type` -

### addDefaultValue

    public static void addDefaultValue(org.objectweb.asm.CodeVisitor cv,
                                       org.objectweb.asm.Type type)

  Adds the default value for a type.

  Parameters:
    `cv` -
    `type` -

### addNullableString

    public static void addNullableString(org.objectweb.asm.CodeVisitor cv,
                                         String value)

  Adds a string and inserts null if the string is null.

  Parameters:
    `cv` -
    `value` -

### getRegisterDepth

    public static int getRegisterDepth(org.objectweb.asm.Type[] typesOnStack)

  Compute the register depth, based on an array of types (long, double = 2 bytes address)

  Parameters:
    `typesOnStack` -
  Returns:
    depth of the stack

### getRegisterIndexOf

    public static int getRegisterIndexOf(org.objectweb.asm.Type[] typesOnStack,
                                         int typeIndex)

  Compute the index on the stack of a given argument based on its index in the signature

  Parameters:
    `typesOnStack` -
    `typeIndex` -
  Returns:

### getTypeIndexOf

    public static int getTypeIndexOf(org.objectweb.asm.Type[] typesOnStack,
                                     int registerIndex)

  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` -
    `registerIndex` -
  Returns:

### isPrimitive

    public static boolean isPrimitive(org.objectweb.asm.Type returnType)

  Checks if the Type is a primitive.

  Parameters:
    `returnType` -
  Returns:
    TRUE/FALSE

### incrementIndex

    public static int incrementIndex(int index,
                                     org.objectweb.asm.Type type)

  Increments the index (takes doubles and longs in to account).

  Parameters:
    `index` -
    `type` -
  Returns:
    the incremented index

### getMethodDescriptor

    public static String getMethodDescriptor(MethodInfo method)

  Returns the descriptor corresponding to the given method info. Adapted from ASM Type.getMethodDescriptor()

  Parameters:
    `method` -
  Returns:
    the descriptor of the given method.

### getConstructorDescriptor

    public static String getConstructorDescriptor(ConstructorInfo constructor)

  Returns the descriptor corresponding to the given constructor info.

  Parameters:
    `constructor` -
  Returns:
    the descriptor of the given constructor.

### getFieldDescriptor

    public static String getFieldDescriptor(FieldInfo field)

  Returns the descriptor corresponding to the given field info.

  Parameters:
    `field` -
  Returns:
    the descriptor of the given field.

### getClassDescriptor

    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.
  Returns:
    the descriptor corresponding to the given class.

### getArgumentTypes

    public static org.objectweb.asm.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.
  Returns:
    the Java types corresponding to the argument types of the given method.

### getType

    public static org.objectweb.asm.Type getType(ClassInfo c)

  Returns the Java type corresponding to the given class. Adapted from ASM getType(Class)

  Parameters:
    `c` - a class.
  Returns:
    the Java type corresponding to the given class.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2005 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.