}
// A JSO impl class needs the class bytes for the original class.
String lookupClassName = canonicalizeClassName(className);
CompiledClass compiledClass = compilationState.getClassFileMap().get(
lookupClassName);
CompilationUnit unit = (compiledClass == null)
? getUnitForClassName(lookupClassName) : compiledClass.getUnit();
if (emmaAvailable) {
/*
* build the map for anonymous classes. Do so only if unit has anonymous
* classes, jsni methods, is not super-source and the map has not been
* built before.
*/
List<JsniMethod> jsniMethods = (unit == null) ? null
: unit.getJsniMethods();
if (unit != null && !unit.isSuperSource() && !unit.isGenerated()
&& unit.hasAnonymousClasses() && jsniMethods != null
&& jsniMethods.size() > 0 && !unit.createdClassMapping()) {
if (!unit.constructAnonymousClassMappings(logger)) {
logger.log(TreeLogger.ERROR,
"Our heuristic for mapping anonymous classes between compilers "
+ "failed. Unsafe to continue because the wrong jsni code "
+ "could end up running. className = " + className);
return null;
}
}
}
byte classBytes[] = null;
if (compiledClass != null) {
classBytes = compiledClass.getBytes();
if (!compiledClass.getUnit().isSuperSource()) {
classBytes = emmaStrategy.getEmmaClassBytes(classBytes,
lookupClassName, compiledClass.getUnit().getLastModified());
} else {
if (logger.isLoggable(TreeLogger.SPAM)) {
logger.log(TreeLogger.SPAM, "no emma instrumentation for "
+ lookupClassName + " because it is from super-source");
}