byte[] classBytes = byteCode.getBytes();
char[] loc = byteCode.getLocation().toCharArray();
try {
logger.log(TreeLogger.SPAM, "Found cached bytes", null);
ClassFileReader cfr = new ClassFileReader(classBytes, loc);
NameEnvironmentAnswer out = new NameEnvironmentAnswer(cfr, null);
nameEnvironmentAnswerForTypeName.put(qname, out);
return out;
} catch (ClassFormatException e) {
// Bad bytecode in the cache. Remove it from the cache.
//
String msg = "Bad bytecode for '" + qname + "'";
compiler.problemReporter.abortDueToInternalError(msg);
return null;
}
}
// Didn't find it in the cache, so let's compile from source.
// Strip off the inner types, if any
//
int pos = qname.indexOf('$');
if (pos >= 0) {
qname = qname.substring(0, pos);
}
CompilationUnitProvider cup;
try {
cup = sourceOracle.findCompilationUnit(logger, qname);
if (cup != null) {
logger.log(TreeLogger.SPAM, "Found type in compilation unit: "
+ cup.getLocation(), null);
ICompilationUnitAdapter unit = new ICompilationUnitAdapter(cup);
NameEnvironmentAnswer out = new NameEnvironmentAnswer(unit, null);
nameEnvironmentAnswerForTypeName.put(qname, out);
return out;
} else {
logger.log(TreeLogger.SPAM, "Not a known type", null);
return null;