public static Type toJimpleType(String desc){
  int idx=desc.lastIndexOf('[');
  int nrDims=idx + 1;
  if (nrDims > 0) {
    if (desc.charAt(0) != '[')     throw new AssertionError("Invalid array descriptor: " + desc);
    desc=desc.substring(idx + 1);
  }
  Type baseType;
switch (desc.charAt(0)) {
case 'Z':
    baseType=BooleanType.v();
  break;
case 'B':
baseType=ByteType.v();
break;
case 'C':
baseType=CharType.v();
break;
case 'S':
baseType=ShortType.v();
break;
case 'I':
baseType=IntType.v();
break;
case 'F':
baseType=FloatType.v();
break;
case 'J':
baseType=LongType.v();
break;
case 'D':
baseType=DoubleType.v();
break;
case 'L':
if (desc.charAt(desc.length() - 1) != ';') throw new AssertionError("Invalid reference descriptor: " + desc);
String name=desc.substring(1,desc.length() - 1);
name=toQualifiedName(name);
baseType=RefType.v(name);
break;
default :
throw new AssertionError("Unknown descriptor: " + desc);
}
if (!(baseType instanceof RefLikeType) && desc.length() > 1) throw new AssertionError("Invalid primitive type descriptor: " + desc);
return nrDims > 0 ? ArrayType.v(baseType,nrDims) : baseType;
}

public static Type toJimpleType ( String desc ) { int idx = desc . lastIndexOf ( '[' ) ; int nrDims = idx + 1 ; if ( nrDims > 0 ) { if ( desc . charAt ( 0 ) != '[' ) throw new AssertionError ( "Invalid array descriptor: " + desc ) ; desc = desc . substring ( idx + 1 ) ; } Type baseType ; switch ( desc . charAt ( 0 ) ) { case 'Z' : baseType = BooleanType . v ( ) ; break ; case 'B' : baseType = ByteType . v ( ) ; break ; case 'C' : baseType = CharType . v ( ) ; break ; case 'S' : baseType = ShortType . v ( ) ; break ; case 'I' : baseType = IntType . v ( ) ; break ; case 'F' : baseType = FloatType . v ( ) ; break ; case 'J' : baseType = LongType . v ( ) ; break ; case 'D' : baseType = DoubleType . v ( ) ; break ; case 'L' : if ( desc . charAt ( desc . length ( ) - 1 ) != ';' ) throw new AssertionError ( "Invalid reference descriptor: " + desc ) ; String name = desc . substring ( 1 , desc . length ( ) - 1 ) ; name = toQualifiedName ( name ) ; baseType = RefType . v ( name ) ; break ; default : throw new AssertionError ( "Unknown descriptor: " + desc ) ; } if ( ! ( baseType instanceof RefLikeType ) && desc . length ( ) > 1 ) throw new AssertionError ( "Invalid primitive type descriptor: " + desc ) ; return nrDims > 0 ? ArrayType . v ( baseType , nrDims ) : baseType ; }
converts a type descriptor to a jimple type .
