public static JCExpression typeIn ( JCExpression tree ) { switch ( tree . getTag ( ) ) { case ANNOTATED_TYPE : return ( ( JCAnnotatedType ) tree ) . underlyingType ; case IDENT : /* simple names */ case TYPEIDENT : /* primitive name */ case SELECT : /* qualified name */ case TYPEARRAY : /* array types */ case WILDCARD : /* wild cards */ case TYPEPARAMETER : /* type parameters */ case TYPEAPPLY : /* parameterized types */ case ERRONEOUS : /* error tree TODO: needed for BadCast JSR308 test case. Better way? */ return tree ; default : throw new AssertionError ( "Unexpected type tree: " + tree ) ; } }
Returns the underlying type of the tree if it is an annotated type or the tree itself otherwise .