aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/ClassPoolTail.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/javassist/ClassPoolTail.java')
-rw-r--r--src/main/javassist/ClassPoolTail.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/javassist/ClassPoolTail.java b/src/main/javassist/ClassPoolTail.java
index 5b013bf8..64560147 100644
--- a/src/main/javassist/ClassPoolTail.java
+++ b/src/main/javassist/ClassPoolTail.java
@@ -17,6 +17,7 @@ package javassist;
import java.io.*;
import java.util.zip.*;
+import java.util.Hashtable;
final class ClassPathList {
ClassPathList next;
@@ -130,10 +131,12 @@ final class JarClassPath implements ClassPath {
final class ClassPoolTail extends ClassPool {
protected ClassPathList pathList;
private Class thisClass;
+ private Hashtable packages; // should be synchronized.
public ClassPoolTail() {
pathList = null;
thisClass = getClass();
+ packages = new Hashtable();
}
public String toString() {
@@ -150,6 +153,14 @@ final class ClassPoolTail extends ClassPool {
return buf.toString();
}
+ /**
+ * You can record "System" so that java.lang.System can be quickly
+ * found although "System" is not a package name.
+ */
+ public void recordInvalidClassName(String name) {
+ packages.put(name, name);
+ }
+
public byte[] write(String classname)
throws NotFoundException, IOException
{
@@ -274,6 +285,9 @@ final class ClassPoolTail extends ClassPool {
public InputStream openClassfile(String classname)
throws NotFoundException
{
+ if (packages.get(classname) != null)
+ throw new NotFoundException(classname);
+
ClassPathList list = pathList;
InputStream ins = null;
NotFoundException error = null;