Class JvmUtil

java.lang.Object
org.plumelib.bcelutil.JvmUtil

@Deprecated public final class JvmUtil extends Object
Utility functions for working with the JVM.

Currently contains conversion utilities between Java and JVM string formats, for types and signatures.

  • Field Details

    • primitiveToFieldDescriptor

      private static HashMap<@PrimitiveType String,@FieldDescriptor String> primitiveToFieldDescriptor
      Deprecated.
      A map from Java primitive type name (such as "int") to field descriptor (such as "I").
    • fieldDescriptorToPrimitive

      private static HashMap<String,String> fieldDescriptorToPrimitive
      Deprecated.
      A map from field descriptor (sach as "I") to Java primitive type (such as "int").
  • Constructor Details

    • JvmUtil

      public JvmUtil()
      Deprecated.
  • Method Details

    • binaryNameToFieldDescriptor

      public static @FieldDescriptor String binaryNameToFieldDescriptor(@BinaryName String classname)
      Deprecated.
      Convert a binary name to a field descriptor. For example, convert "java.lang.Object[]" to "[Ljava/lang/Object;" or "int" to "I" or "pkg.Outer$Inner" to "Lpkg/Outer$Inner;".

      There are no binary names for primitives or array types. Nonetheless, this method works for them. It converts "java.lang.Object[]" to "[Ljava/lang/Object;" or "int" to "I".

      Parameters:
      classname - name of the class, in binary class name format
      Returns:
      name of the class, in field descriptor format
    • primitiveTypeNameToFieldDescriptor

      public static @FieldDescriptor String primitiveTypeNameToFieldDescriptor(String primitiveName)
      Deprecated.
      Convert a primitive Java type name (e.g., "int", "double", etc.) to a field descriptor (e.g., "I", "D", etc.).
      Parameters:
      primitiveName - name of the type, in Java format
      Returns:
      name of the type, in field descriptor format
      Throws:
      IllegalArgumentException - if primitiveName is not a valid primitive type name
    • binaryNameToClassGetName

      public static @ClassGetName String binaryNameToClassGetName(@BinaryName String bn)
      Deprecated.
      Convert from a BinaryName to the format of Class.getName().

      There are no binary names for primitives or array types. Nonetheless, this method works for them. It converts "java.lang.Object[]" to "[Ljava.lang.Object;" or "int" to "int".

      Parameters:
      bn - the binary name to convert
      Returns:
      the class name, in Class.getName format
    • fieldDescriptorToClassGetName

      public static @ClassGetName String fieldDescriptorToClassGetName(@FieldDescriptor String fd)
      Deprecated.
      Convert from a FieldDescriptor to the format of Class.getName().
      Parameters:
      fd - the class, in field descriptor format
      Returns:
      the class name, in Class.getName format
    • arglistToJvm

      public static String arglistToJvm(String arglist)
      Deprecated.
      Convert a fully-qualified argument list from Java format to JVML format. For example, convert "(java.lang.Integer[], int, java.lang.Integer[][])" to "([Ljava/lang/Integer;I[[Ljava/lang/Integer;)".
      Parameters:
      arglist - an argument list, in Java format
      Returns:
      argument list, in JVML format
    • fieldDescriptorToBinaryName

      public static @BinaryName String fieldDescriptorToBinaryName(String classname)
      Deprecated.
      Convert a field descriptor to a binary name. For example, convert "[Ljava/lang/Object;" to "java.lang.Object[]" or "I" to "int".
      Parameters:
      classname - name of the type, in JVML format
      Returns:
      name of the type, in Java format
    • arglistFromJvm

      public static String arglistFromJvm(String arglist)
      Deprecated.
      Convert an argument list from JVML format to Java format. For example, convert "([Ljava/lang/Integer;I[[Ljava/lang/Integer;)" to "(java.lang.Integer[], int, java.lang.Integer[][])".

      The argument is the first part of a method descriptor.

      Parameters:
      arglist - an argument list, in JVML format
      Returns:
      argument list, in Java format