if (log.isTraceEnabled())
log.trace("Creating AnnotationEnvironment for " + unit.getName() + ", module: " + module + ", force annotations: " + forceAnnotations);
ClassLoader classLoader = unit.getClassLoader();
ClassPool pool = createClassPool(classLoader);
GenericAnnotationResourceVisitor visitor = createGenericAnnotationResourceVisitor(unit, pool, classLoader);
// something in javassist uses TCL
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
try
{
visitModule(unit, module, visitor);
}
finally
{
Thread.currentThread().setContextClassLoader(tcl);
}
unit.addAttachment(AnnotationEnvironment.class, visitor.getEnv());
}