Patch: more loader test code
Anthony Green
green@redhat.com
Mon Nov 4 06:01:00 GMT 2002
FYI, I've checked this test in.
2002-11-04 Anthony Green <green@redhat.com>
* libjava.loader/MyLoader.java: New constructor.
* libjava.loader/TestParent.java: New file.
* libjava.loader/TestParent.out: New file.
Index: testsuite/libjava.loader/MyLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/libjava.loader/MyLoader.java,v
retrieving revision 1.1
diff -2 -c -p -r1.1 MyLoader.java
*** testsuite/libjava.loader/MyLoader.java 4 Nov 2002 01:31:12 -0000 1.1
--- testsuite/libjava.loader/MyLoader.java 4 Nov 2002 13:59:22 -0000
*************** public class MyLoader extends URLClassLo
*** 7,9 ****
--- 7,14 ----
super (urls);
}
+
+ public MyLoader (URL urls[], ClassLoader parent)
+ {
+ super (urls, parent);
+ }
}
Index: testsuite/libjava.loader/TestParent.java
===================================================================
RCS file: testsuite/libjava.loader/TestParent.java
diff -N testsuite/libjava.loader/TestParent.java
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/libjava.loader/TestParent.java 4 Nov 2002 13:59:22 -0000
***************
*** 0 ****
--- 1,29 ----
+ import java.net.*;
+
+ public class TestParent
+ {
+ public static void main (String[] args)
+ {
+ URLClassLoader ucl =
+ (URLClassLoader) ClassLoader.getSystemClassLoader();
+ URL urls[] = ucl.getURLs ();
+
+ MyLoader parent = new MyLoader (urls);
+
+ MyLoader t1 = new MyLoader (urls, parent);
+ MyLoader t2 = new MyLoader (urls, parent);
+
+ Class c1, c2;
+
+ try {
+
+ c1 = t1.loadClass ("dummy");
+ c2 = t2.loadClass ("dummy");
+
+ }
+ catch (Exception e) {
+ e.printStackTrace ();
+ }
+ }
+ }
+
Index: testsuite/libjava.loader/TestParent.out
===================================================================
RCS file: testsuite/libjava.loader/TestParent.out
diff -N testsuite/libjava.loader/TestParent.out
More information about the Java-patches
mailing list