<line text="info AspectJ Weaver Version"/>
<line text="info register classloader"/>
<line text="info using"/>
- <line text="info register aspect"/>
<line text="info [bcelRepositoryCaching=false] AspectJ will not"/>
+ <line text="info register aspect"/>
<line text="info processing"/>
<line text="info successfully"/>
</stderr>
private ClassPathManager classPath;
protected Repository delegate;
+ private ClassLoader loader;
//private ClassPathManager aspectPath = null;
*/
public BcelWorld(ClassLoader loader, IMessageHandler handler, ICrossReferenceHandler xrefHandler) {
this.classPath = null;
+ this.loader = loader;
setMessageHandler(handler);
setCrossReferenceHandler(xrefHandler);
// Tell BCEL to use us for resolving any classes
- delegate = getClassLoaderRepositoryFor(loader);
- // TODO Alex do we need to call org.aspectj.apache.bcel.Repository.setRepository(delegate);
- // if so, how can that be safe in J2EE ?? (static stuff in Bcel)
+ // delegate = getClassLoaderRepositoryFor(loader);
+ }
+
+ public void ensureRepositorySetup() {
+ if (delegate==null) {
+ delegate = getClassLoaderRepositoryFor(loader);
+ }
}
- public Repository getClassLoaderRepositoryFor(ClassLoader loader) {
+ public Repository getClassLoaderRepositoryFor(ClassLoader loader) {
if (bcelRepositoryCaching) {
return new ClassLoaderRepository(loader);
} else {
private JavaClass lookupJavaClass(ClassPathManager classPath, String name) {
if (classPath == null) {
try {
+ ensureRepositorySetup();
JavaClass jc = delegate.loadClass(name);
if (trace.isTraceEnabled()) trace.event("lookupJavaClass",this,new Object[] { name, jc });
return jc;
decpToRepeat = decpToRepeatNextTime;
}
}
+
}
\ No newline at end of file