diff options
author | Andy Clement <aclement@pivotal.io> | 2022-01-13 17:57:51 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2022-01-13 17:57:51 -0800 |
commit | 3227aad604f040cdced47d7a8462acf563f52ef6 (patch) | |
tree | 787456001679954ecfaa006e1024e949e125015f /weaver | |
parent | 4ee5489a4ad8276895e35bb382d84075aff9c11b (diff) | |
download | aspectj-3227aad604f040cdced47d7a8462acf563f52ef6.tar.gz aspectj-3227aad604f040cdced47d7a8462acf563f52ef6.zip |
Couple of basic tests for the repository optimizations
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java index e0e1af8d2..1e673532e 100644 --- a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java +++ b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java @@ -49,8 +49,8 @@ public class Java15AnnotationFinder implements AnnotationFinder, ArgNameFinder { private World world; private static boolean useCachingClassLoaderRepository; - //Use single instance of Repository and ClassLoader - public static final boolean useSingleInstances = + // Use single instance of Repository and ClassLoader + public static boolean useSingleInstances = System.getProperty("org.aspectj.apache.bcel.useSingleRepositoryInstance", "false").equalsIgnoreCase("true"); static { @@ -66,24 +66,26 @@ public class Java15AnnotationFinder implements AnnotationFinder, ArgNameFinder { } public void setClassLoader(ClassLoader aLoader) { - //Set class loader ref - if (useSingleInstances && staticClassLoaderRef == null) + // Set class loader ref + if (useSingleInstances && staticClassLoaderRef == null) { staticClassLoaderRef = new BcelWeakClassLoaderReference(aLoader); - else + } else { this.classLoaderRef = new BcelWeakClassLoaderReference(aLoader); + } - //Set repository + // Set repository if (useCachingClassLoaderRepository) { - if (useSingleInstances && staticBcelRepository == null) + if (useSingleInstances && staticBcelRepository == null) { staticBcelRepository = new ClassLoaderRepository(getClassLoader()); - else + } else { this.bcelRepository = new ClassLoaderRepository(classLoaderRef); - } - else { - if (useSingleInstances && staticBcelRepository == null) + } + } else { + if (useSingleInstances && staticBcelRepository == null) { staticBcelRepository = new NonCachingClassLoaderRepository(getClassLoader()); - else + } else { this.bcelRepository = new NonCachingClassLoaderRepository(classLoaderRef); + } } } |