src/main/java/org/plumelib/bcelutil/JvmUtil.java
@SuppressWarnings("signature") // conversion routine
  public static @FieldDescriptor String binaryNameToFieldDescriptor(@BinaryName String classname) {
    int dims = 0;
    String sansArray = classname;
    while (sansArray.endsWith("[]")) {
      dims++;
      sansArray = sansArray.substring(0, sansArray.length() - 2);
    }
    String result = primitiveClassesJvm.get(sansArray);
    if (result == null) {
      result = "L" + sansArray + ";";
    }
    for (int i = 0; i < dims; i++) {
      result = "[" + result;
    }
    return result.replace('.', '/');
  }
@SuppressWarnings("signature") // conversion routine
  public static @FieldDescriptor String binaryNameToFieldDescriptor(@BinaryName String classname) {
    int dims = 0;
    String sansArray = classname;
    while (sansArray.endsWith("[]")) {
      dims++;
      sansArray = sansArray.substring(0, sansArray.length() - 2);
    }
    String result = primitiveClassesJvm.get(sansArray);
    if (result == null) {
      result = "L" + sansArray + ";";
    }
    for (int i = 0; i < dims; i++) {
      result = "[" + result;
    }
    return result.replace('.', '/');
  }
@ SuppressWarnings ( "signature" ) // conversion routine public static @ FieldDescriptor String binaryNameToFieldDescriptor ( @ BinaryName String classname ) { int dims = 0 ; String sansArray = classname ; while ( sansArray . endsWith ( "[]" ) ) { dims ++ ; sansArray = sansArray . substring ( 0 , sansArray . length ( ) - 2 ) ; } String result = primitiveClassesJvm . get ( sansArray ) ; if ( result == null ) { result = "L" + sansArray + ";" ; } for ( int i = 0 ; i < dims ; i ++ ) { result = "[" + result ; } return result . replace ( ' ' , ' ' ) ; }
Convert a binary name to a field descriptor. For example, convert "java.lang.Object[]" to
"[Ljava/lang/Object;" or "int" to "I".

@param classname name of the class, in binary class name format
@return name of the class, in field descriptor format
Convert a binary name to a field descriptor . For example convert java . lang . Object [] to [ Ljava / lang / Object ; or int to I .