* src/vmcore/loader.c (load_class_from_classbuffer_intern): Also call
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Wed, 26 Mar 2008 16:57:56 +0000 (17:57 +0100)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Wed, 26 Mar 2008 16:57:56 +0000 (17:57 +0100)
resolve_handle_pending_exception for super interfaces.
* tests/regression/bugzilla/PR58.java (test): Renamed to
testSuperClass.
(testSuperInterface): New method.

src/vmcore/loader.c
tests/regression/bugzilla/PR58.java

index a2b754e7b7209aa7cd7c76ccdfbe1f7a6d33fd1b..1c0efb1e6cc7f2354f7f333a24279bb019779208 100644 (file)
@@ -1690,8 +1690,10 @@ static bool load_class_from_classbuffer_intern(classbuffer *cb)
                /* XXX This should be done better. */
                tc = resolve_classref_or_classinfo_eager(CLASSREF_OR_CLASSINFO(cr), false);
 
-               if (tc == NULL)
+               if (tc == NULL) {
+                       resolve_handle_pending_exception(true);
                        return false;
+               }
 
                /* Detect circularity. */
 
index 1451226445b31b1974dbc2336cb9591d5c77d3cb..d70281c294ae1fa367c728bdcd70a6eb4a0652f2 100644 (file)
@@ -40,7 +40,7 @@ public class PR58 extends TestCase {
     class x extends y {}
     class y {}
 
-    public void test() {
+    public void testSuperClass() {
         // Delete the class file which is extended.
         new File("PR58$y.class").delete();
 
@@ -56,4 +56,24 @@ public class PR58 extends TestCase {
             assertTrue(success.getCause() instanceof ClassNotFoundException);
         }
     }
+
+    interface i {}
+    class j implements i {}
+
+    public void testSuperInterface() {
+        // Delete the interface file which is implemented.
+        new File("PR58$i.class").delete();
+
+        try {
+            Class.forName("PR58$j");
+            fail("Should throw NoClassDefFoundError");
+        }
+        catch (ClassNotFoundException error) {
+            fail("Unexpected exception: " + error);
+        }
+        catch (NoClassDefFoundError success) {
+            // Check if the cause is correct.
+            assertTrue(success.getCause() instanceof ClassNotFoundException);
+        }
+    }
 }