diff options
Diffstat (limited to 'vm/reference/java')
-rwxr-xr-x | vm/reference/java/lang/Class.java | 5 | ||||
-rw-r--r-- | vm/reference/java/lang/VMClassLoader.java | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/vm/reference/java/lang/Class.java b/vm/reference/java/lang/Class.java index 1ed01eb01..de2b5b240 100755 --- a/vm/reference/java/lang/Class.java +++ b/vm/reference/java/lang/Class.java @@ -187,7 +187,10 @@ public final class Class implements Serializable if (cl != null) sm.checkPermission(new RuntimePermission("getClassLoader")); } - return VMClassLoader.loadClass(name, initialize); + Class c = VMClassLoader.loadClass(name, initialize); + if (c != null) + return c; + throw new ClassNotFoundException(name); } return classloader.loadClass(name, initialize); } diff --git a/vm/reference/java/lang/VMClassLoader.java b/vm/reference/java/lang/VMClassLoader.java index 77e2810c5..107f1745e 100644 --- a/vm/reference/java/lang/VMClassLoader.java +++ b/vm/reference/java/lang/VMClassLoader.java @@ -117,12 +117,14 @@ final class VMClassLoader * * @param name the class name to load * @param resolve whether to resolve it - * @return the class, loaded by the bootstrap classloader + * @return the class, loaded by the bootstrap classloader or null + * if the class wasn't found. Returning null is equivalent to throwing + * a ClassNotFoundException (but a possible performance optimization). */ static final Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - throw new ClassNotFoundException(name); + return null; } /** |