aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder/src/org
diff options
context:
space:
mode:
authoraclement <aclement>2004-11-18 16:00:19 +0000
committeraclement <aclement>2004-11-18 16:00:19 +0000
commit9f1649a4d9717c8b7997a8d0063deaf693e680ec (patch)
tree21b174b64f2706e365439f2c2faa172204498249 /bcel-builder/src/org
parent3838917cde7137099d8ef8bb5f137ee9abc898d4 (diff)
downloadaspectj-9f1649a4d9717c8b7997a8d0063deaf693e680ec.tar.gz
aspectj-9f1649a4d9717c8b7997a8d0063deaf693e680ec.zip
Some enhancements discovered whilst working on bugzilla bug 78954: Compiler cannot cope with 4000 jars on the classpath. These enhancements cause things to be done 'lazily' in BCEL.
Diffstat (limited to 'bcel-builder/src/org')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/Repository.java24
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java10
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java12
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/util/SyntheticRepository.java4
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/verifier/VerifierFactory.java4
5 files changed, 32 insertions, 22 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/Repository.java b/bcel-builder/src/org/aspectj/apache/bcel/Repository.java
index c848fcb04..f4e54b1bf 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/Repository.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/Repository.java
@@ -66,16 +66,18 @@ import java.io.*;
* @see org.aspectj.apache.bcel.util.Repository
* @see org.aspectj.apache.bcel.util.SyntheticRepository
*
- * @version $Id: Repository.java,v 1.1 2004/11/18 14:48:12 aclement Exp $
+ * @version $Id: Repository.java,v 1.2 2004/11/18 16:00:19 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
public abstract class Repository {
private static org.aspectj.apache.bcel.util.Repository _repository =
- SyntheticRepository.getInstance();
+ null;
/** @return currently used repository instance
*/
public static org.aspectj.apache.bcel.util.Repository getRepository() {
+ if (_repository == null) _repository = SyntheticRepository.getInstance();
+
return _repository;
}
@@ -93,10 +95,10 @@ public abstract class Repository {
*/
public static JavaClass lookupClass(String class_name) {
try {
- JavaClass clazz = _repository.findClass(class_name);
+ JavaClass clazz = getRepository().findClass(class_name);
if(clazz == null) {
- return _repository.loadClass(class_name);
+ return getRepository().loadClass(class_name);
} else {
return clazz;
}
@@ -110,7 +112,7 @@ public abstract class Repository {
*/
public static JavaClass lookupClass(Class clazz) {
try {
- return _repository.loadClass(clazz);
+ return getRepository().loadClass(clazz);
} catch(ClassNotFoundException ex) { return null; }
}
@@ -118,14 +120,14 @@ public abstract class Repository {
*/
public static ClassPath.ClassFile lookupClassFile(String class_name) {
try {
- return ClassPath.SYSTEM_CLASS_PATH.getClassFile(class_name);
+ return ClassPath.getSystemClassPath().getClassFile(class_name);
} catch(IOException e) { return null; }
}
/** Clear the repository.
*/
public static void clearCache() {
- _repository.clear();
+ getRepository().clear();
}
/**
@@ -134,8 +136,8 @@ public abstract class Repository {
* @return old entry in repository
*/
public static JavaClass addClass(JavaClass clazz) {
- JavaClass old = _repository.findClass(clazz.getClassName());
- _repository.storeClass(clazz);
+ JavaClass old = getRepository().findClass(clazz.getClassName());
+ getRepository().storeClass(clazz);
return old;
}
@@ -143,14 +145,14 @@ public abstract class Repository {
* Remove class with given (fully qualified) name from repository.
*/
public static void removeClass(String clazz) {
- _repository.removeClass(_repository.findClass(clazz));
+ getRepository().removeClass(getRepository().findClass(clazz));
}
/**
* Remove given class from repository.
*/
public static void removeClass(JavaClass clazz) {
- _repository.removeClass(clazz);
+ getRepository().removeClass(clazz);
}
/**
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
index 1574b05e3..5aa423f2d 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
@@ -73,7 +73,7 @@ import java.util.StringTokenizer;
* class file. Those interested in programatically generating classes
* should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
- * @version $Id: JavaClass.java,v 1.1 2004/11/18 14:48:11 aclement Exp $
+ * @version $Id: JavaClass.java,v 1.2 2004/11/18 16:00:19 aclement Exp $
* @see org.aspectj.apache.bcel.generic.ClassGen
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -106,8 +106,7 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
* use the default SyntheticRepository, because we
* don't know any better.
*/
- private transient org.aspectj.apache.bcel.util.Repository repository =
- SyntheticRepository.getInstance();
+ private transient org.aspectj.apache.bcel.util.Repository repository = null;
/**
* Constructor gets all contents as arguments.
@@ -672,6 +671,7 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
* this is the same as SyntheticRepository.getInstance();
*/
public org.aspectj.apache.bcel.util.Repository getRepository() {
+ if (repository == null) repository = SyntheticRepository.getInstance();
return repository;
}
@@ -739,7 +739,7 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
}
try {
- return repository.loadClass(getSuperclassName());
+ return getRepository().loadClass(getSuperclassName());
} catch(ClassNotFoundException e) {
System.err.println(e);
return null;
@@ -772,7 +772,7 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
try {
for(int i = 0; i < interfaces.length; i++) {
- classes[i] = repository.loadClass(interfaces[i]);
+ classes[i] = getRepository().loadClass(interfaces[i]);
}
} catch(ClassNotFoundException e) {
System.err.println(e);
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java
index 4658e4927..39acde6c0 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java
@@ -62,12 +62,20 @@ import java.io.*;
* Responsible for loading (class) files from the CLASSPATH. Inspired by
* sun.tools.ClassPath.
*
- * @version $Id: ClassPath.java,v 1.1 2004/11/18 14:48:12 aclement Exp $
+ * @version $Id: ClassPath.java,v 1.2 2004/11/18 16:00:19 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
public class ClassPath implements Serializable {
- public static final ClassPath SYSTEM_CLASS_PATH = new ClassPath();
+ private static ClassPath SYSTEM_CLASS_PATH;
+
+ public static ClassPath getSystemClassPath() {
+ if (SYSTEM_CLASS_PATH==null) {
+ SYSTEM_CLASS_PATH = new ClassPath();
+ }
+ return SYSTEM_CLASS_PATH;
+ }
+
private PathEntry[] paths;
private String class_path;
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/util/SyntheticRepository.java b/bcel-builder/src/org/aspectj/apache/bcel/util/SyntheticRepository.java
index e2e0c90b8..36936794e 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/util/SyntheticRepository.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/util/SyntheticRepository.java
@@ -78,7 +78,7 @@ import org.aspectj.apache.bcel.classfile.JavaClass;
*
* @see org.aspectj.apache.bcel.Repository
*
- * @version $Id: SyntheticRepository.java,v 1.2 2004/11/18 15:07:05 aclement Exp $
+ * @version $Id: SyntheticRepository.java,v 1.3 2004/11/18 16:00:19 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @author David Dixon-Peugh
*/
@@ -95,7 +95,7 @@ public class SyntheticRepository implements Repository {
}
public static SyntheticRepository getInstance() {
- return getInstance(ClassPath.SYSTEM_CLASS_PATH);
+ return getInstance(ClassPath.getSystemClassPath());
}
public static SyntheticRepository getInstance(ClassPath classPath) {
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/verifier/VerifierFactory.java b/bcel-builder/src/org/aspectj/apache/bcel/verifier/VerifierFactory.java
index 683c5c546..15f9547de 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/verifier/VerifierFactory.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/verifier/VerifierFactory.java
@@ -64,7 +64,7 @@ import java.util.Vector;
* operate on. That means, for every class (represented by a unique fully qualified
* class name) there is exactly one Verifier.
*
- * @version $Id: VerifierFactory.java,v 1.1 2004/11/18 14:48:12 aclement Exp $
+ * @version $Id: VerifierFactory.java,v 1.2 2004/11/18 16:00:19 aclement Exp $
* @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
* @see org.aspectj.apache.bcel.verifier.Verifier
*/
@@ -91,7 +91,7 @@ public class VerifierFactory{
* @return the (only) verifier responsible for the class with the given name.
*/
public static Verifier getVerifier(String fully_qualified_classname){
- fully_qualified_classname = fully_qualified_classname;
+ //fully_qualified_classname = fully_qualified_classname;
Verifier v = (Verifier) (hashMap.get(fully_qualified_classname));
if (v==null){