Sfoglia il codice sorgente

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.

tags/Root_AspectJ5_Development
aclement 19 anni fa
parent
commit
9f1649a4d9

+ 13
- 11
bcel-builder/src/org/aspectj/apache/bcel/Repository.java Vedi File

@@ -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);
}

/**

+ 5
- 5
bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java Vedi File

@@ -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);

+ 10
- 2
bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java Vedi File

@@ -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;


+ 2
- 2
bcel-builder/src/org/aspectj/apache/bcel/util/SyntheticRepository.java Vedi File

@@ -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) {

+ 2
- 2
bcel-builder/src/org/aspectj/apache/bcel/verifier/VerifierFactory.java Vedi File

@@ -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){

Loading…
Annulla
Salva