Type sigToType ( ) { switch ( ( char ) signature [ sigp ] ) { case ' ' : sigp ++ ; int start = sigp ; while ( signature [ sigp ] != ' ' ) sigp ++ ; sigp ++ ; return sigEnterPhase ? Type . noType : findTypeVar ( names . fromUtf ( signature , start , sigp - 1 - start ) ) ; case ' ' : { sigp ++ ; Type t = sigToType ( ) ; return new WildcardType ( t , BoundKind . EXTENDS , syms . boundClass ) ; } case ' ' : sigp ++ ; return new WildcardType ( syms . objectType , BoundKind . UNBOUND , syms . boundClass ) ; case ' ' : { sigp ++ ; Type t = sigToType ( ) ; return new WildcardType ( t , BoundKind . SUPER , syms . boundClass ) ; } case ' ' : sigp ++ ; return syms . byteType ; case ' ' : sigp ++ ; return syms . charType ; case ' ' : sigp ++ ; return syms . doubleType ; case ' ' : sigp ++ ; return syms . floatType ; case ' ' : sigp ++ ; return syms . intType ; case ' ' : sigp ++ ; return syms . longType ; case ' ' : { // int oldsigp = sigp; Type t = classSigToType ( ) ; if ( sigp < siglimit && signature [ sigp ] == ' ' ) throw badClassFile ( "deprecated inner class signature syntax " + "(please recompile from source)" ) ; /* System.err.println(" decoded " + new String(signature, oldsigp, sigp-oldsigp) + " => " + t + " outer " + t.outer()); */ return t ; } case ' ' : sigp ++ ; return syms . shortType ; case ' ' : sigp ++ ; return syms . voidType ; case ' ' : sigp ++ ; return syms . booleanType ; case ' ' : sigp ++ ; return new ArrayType ( sigToType ( ) , syms . arrayClass ) ; case ' ' : sigp ++ ; List < Type > argtypes = sigToTypes ( ' ' ) ; Type restype = sigToType ( ) ; List < Type > thrown = List . nil ( ) ; while ( signature [ sigp ] == ' ' ) { sigp ++ ; thrown = thrown . prepend ( sigToType ( ) ) ; } // if there is a typevar in the throws clause we should state it. for ( List < Type > l = thrown ; l . nonEmpty ( ) ; l = l . tail ) { if ( l . head . hasTag ( TYPEVAR ) ) { l . head . tsym . flags_field |= THROWS ; } } return new MethodType ( argtypes , restype , thrown . reverse ( ) , syms . methodClass ) ; case ' ' : typevars = typevars . dup ( currentOwner ) ; Type poly = new ForAll ( sigToTypeParams ( ) , sigToType ( ) ) ; typevars = typevars . leave ( ) ; return poly ; default : throw badClassFile ( "bad.signature" , Convert . utf2string ( signature , sigp , 10 ) ) ; } }
Convert signature to type where signature is implicit .