List of usage examples for org.eclipse.jdt.internal.compiler.lookup ParameterizedTypeBinding environment
LookupEnvironment environment
To view the source code for org.eclipse.jdt.internal.compiler.lookup ParameterizedTypeBinding environment.
Click Source Link
From source file:org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.java
License:Open Source License
TypeBinding toRawType(TypeBinding tb) {
if (tb instanceof ParameterizedTypeBinding) {
ParameterizedTypeBinding ptb = (ParameterizedTypeBinding) tb;
// resolver.getScope() can return null (if the resolver hasn't yet been used to resolve something) - using
// the environment on the ptb seems safe. Other occurrences of getScope in this file could feasibly
// be changed in the same way if NPEs become problems there too
return ptb.environment().convertToRawType(ptb.genericType(), false);
// return resolver.getScope().environment.convertToRawType(ptb.genericType(), false);
} else if (tb instanceof TypeVariableBinding) {
TypeBinding fb = ((TypeVariableBinding) tb).firstBound;
if (fb == null) {
return tb.erasure(); // Should be JLObject
// return resolver.getScope().getJavaLangObject();
}/*from w ww. j av a2 s . c om*/
return fb;
} else if (tb instanceof BinaryTypeBinding) {
if (tb.isGenericType()) {
try {
Field f = BinaryTypeBinding.class.getDeclaredField("environment");
f.setAccessible(true);
LookupEnvironment le = (LookupEnvironment) f.get(tb);
return le.convertToRawType(tb, false);
// return resolver.getScope().environment.convertToRawType(tb, false);
} catch (Exception e) {
throw new RuntimeException("Problem building rawtype ", e);
}
} else {
return tb;
}
} else if (tb instanceof ArrayBinding) {
return tb;
} else if (tb instanceof BaseTypeBinding) {
return tb;
} else if (tb instanceof SourceTypeBinding) {
return tb;
}
throw new IllegalStateException("nyi " + tb.getClass());
}