From 23e4e9827e54ab6cd1980787a293f9957264e024 Mon Sep 17 00:00:00 2001 From: chiba Date: Sun, 1 Jan 2006 14:55:28 +0000 Subject: [PATCH] changed to generate more javap-friendly code git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@228 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- .classpath | 6 +++--- .project | 10 ++++++++++ src/main/javassist/bytecode/ConstPool.java | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.classpath b/.classpath index 9a7217cb..a838c8dc 100644 --- a/.classpath +++ b/.classpath @@ -1,7 +1,7 @@ - - + + - + diff --git a/.project b/.project index 704e76bb..20b52261 100644 --- a/.project +++ b/.project @@ -10,6 +10,16 @@ + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/Ant.launch + + + org.eclipse.jdt.core.javanature diff --git a/src/main/javassist/bytecode/ConstPool.java b/src/main/javassist/bytecode/ConstPool.java index 3a3443d1..83159d21 100644 --- a/src/main/javassist/bytecode/ConstPool.java +++ b/src/main/javassist/bytecode/ConstPool.java @@ -905,6 +905,15 @@ public final class ConstPool { --n; } } + + int i = 1; + while (true) { + ConstInfo info = (ConstInfo)items.elementAt(i++); + if (info == null) + break; + else + info.makeHashtable(this); + } } private int readOne(DataInputStream in) throws IOException { @@ -997,6 +1006,8 @@ abstract class ConstInfo { public abstract void write(DataOutputStream out) throws IOException; public abstract void print(PrintWriter out); + void makeHashtable(ConstPool cp) {} // called after read() finishes in ConstPool. + public String toString() { ByteArrayOutputStream bout = new ByteArrayOutputStream(); PrintWriter out = new PrintWriter(bout); @@ -1087,6 +1098,11 @@ class ClassInfo extends ConstInfo { out.print("Class #"); out.println(name); } + + void makeHashtable(ConstPool cp) { + String name = Descriptor.toJavaName(getClassName(cp)); + cp.classes.put(name, this); + } } class NameAndTypeInfo extends ConstInfo { -- 2.39.5