Multiple class loaders problem

Tom Tromey tromey@redhat.com
Sun Nov 3 17:35:00 GMT 2002


>>>>> "Anthony" == Anthony Green <green@redhat.com> writes:

Anthony> class MyLoader extends URLClassLoader
This class has to be `static'. gcj shouldn't compile this.
Could you submit a PR for this?
The IBM JDK verifier chokes on the output (of the original test, not
the one with `static' added), but neither gcj nor gij diagnose a
problem. Could you put in a PR for that too? I don't want to look at
it right now. I guess attaching the bytecode is the best way since we
won't be able to reproduce it once the compiler bug is fixed.
I agree with your assessment of the bug you reported. Try the appended.
It works for me.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
	* java/lang/ClassLoader.java (loadClass): Call loadClass on
	VMClassLoader, not findClass.
Index: java/lang/ClassLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
retrieving revision 1.19
diff -u -r1.19 ClassLoader.java
--- java/lang/ClassLoader.java 19 Sep 2002 17:44:49 -0000 1.19
+++ java/lang/ClassLoader.java 4 Nov 2002 01:35:03 -0000
@@ -177,14 +177,18 @@
 
 if (c == null)
 {
-	try {
-	 if (parent != null)
-	 return parent.loadClass (name, link);
-	 else
-	 c = gnu.gcj.runtime.VMClassLoader.instance.findClass (name);
-	} catch (ClassNotFoundException ex) {
-	 /* ignore, we'll try findClass */;
-	}
+	try
+	 {
+	 ClassLoader cl = parent;
+	 if (parent == null)
+	 cl = gnu.gcj.runtime.VMClassLoader.instance;
+	 if (cl != this)
+	 c = cl.loadClass (name, link);
+	 }
+	catch (ClassNotFoundException ex)
+	 {
+	 /* ignore, we'll try findClass */;
+	 }
 }
 
 if (c == null)


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /