Package jodd.asm

Class AsmUtil


  • public class AsmUtil
    extends java.lang.Object
    Generic ASM utils.
    • Constructor Detail

      • AsmUtil

        public AsmUtil()
    • Method Detail

      • typedesc2ClassName

        public static java.lang.String typedesc2ClassName​(java.lang.String desc)
        Converts bytecode-like description to java class name that can be loaded with a classloader. Uses less-known feature of class loaders for loading array classes.
        See Also:
        typedescToSignature(String, MutableInteger)
      • typeref2Name

        public static java.lang.String typeref2Name​(java.lang.String desc)
        Converts type reference to java-name.
      • typeNameToOpcode

        public static char typeNameToOpcode​(java.lang.String typeName)
        Returns type-name to type char. Arrays are not supported.
      • typedescToSignature

        public static java.lang.String typedescToSignature​(java.lang.String desc,
                                                           MutableInteger from)
        Returns java-like signature of a bytecode-like description. Only first description is parsed. The field signature represents the value of an argument to a function or the value of a variable. It is a series of bytes generated by the following grammar:
        
         <field_signature> ::= <field_type>
         <field_type>      ::= <base_type>|<object_type>|<array_type>
         <base_type>       ::= B|C|D|F|I|J|S|Z
         <object_type>     ::= L<fullclassname>;
         <array_type>      ::= [<field_type>
        
         The meaning of the base types is as follows:
         B byte signed byte
         C char character
         D double double precision IEEE float
         F float single precision IEEE float
         I int integer
         J long long integer
         L<fullclassname>; ... an object of the given class
         S short signed short
         Z boolean true or false
         [<field sig> ... array
         
        This method converts this string into a Java type declaration such as String[].
      • typeToSignature

        public static java.lang.String typeToSignature​(java.lang.String className)
        Converts java-class name ("foo.Bar") to bytecode-signature ("foo/bar").
      • typeToSignature

        public static java.lang.String typeToSignature​(java.lang.Class type)
        Converts java-class name ("foo.Bar") to bytecode-name ("foo/bar").
      • typeToTyperef

        public static java.lang.String typeToTyperef​(java.lang.Class type)
        Converts type to byteccode type ref.
      • intValue

        public static void intValue​(MethodVisitor mv)
        Converts Integer object to an int.
      • longValue

        public static void longValue​(MethodVisitor mv)
        Converts Long object to a long.
      • floatValue

        public static void floatValue​(MethodVisitor mv)
        Converts Float object to a float.
      • doubleValue

        public static void doubleValue​(MethodVisitor mv)
        Converts Double object to a double.
      • byteValue

        public static void byteValue​(MethodVisitor mv)
        Converts Byte object to a byte.
      • shortValue

        public static void shortValue​(MethodVisitor mv)
        Converts Short object to a short.
      • booleanValue

        public static void booleanValue​(MethodVisitor mv)
        Converts Boolean object to a boolean.
      • charValue

        public static void charValue​(MethodVisitor mv)
        Converts Character object to a char.
      • valueOfInteger

        public static void valueOfInteger​(MethodVisitor mv)
      • valueOfLong

        public static void valueOfLong​(MethodVisitor mv)
      • valueOfFloat

        public static void valueOfFloat​(MethodVisitor mv)
      • valueOfDouble

        public static void valueOfDouble​(MethodVisitor mv)
      • valueOfByte

        public static void valueOfByte​(MethodVisitor mv)
      • valueOfShort

        public static void valueOfShort​(MethodVisitor mv)
      • valueOfBoolean

        public static void valueOfBoolean​(MethodVisitor mv)
      • valueOfCharacter

        public static void valueOfCharacter​(MethodVisitor mv)
      • removeGenericsFromSignature

        public static java.lang.String removeGenericsFromSignature​(java.lang.String signature)