From 10762ee8a1bda8782b76e11d8e015d55b2f3fd5b Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Wed, 26 Mar 2008 17:57:56 +0100 Subject: [PATCH] * src/vmcore/loader.c (load_class_from_classbuffer_intern): Also call resolve_handle_pending_exception for super interfaces. * tests/regression/bugzilla/PR58.java (test): Renamed to testSuperClass. (testSuperInterface): New method. --- src/vmcore/loader.c | 4 +++- tests/regression/bugzilla/PR58.java | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/vmcore/loader.c b/src/vmcore/loader.c index a2b754e7b..1c0efb1e6 100644 --- a/src/vmcore/loader.c +++ b/src/vmcore/loader.c @@ -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. */ diff --git a/tests/regression/bugzilla/PR58.java b/tests/regression/bugzilla/PR58.java index 145122644..d70281c29 100644 --- a/tests/regression/bugzilla/PR58.java +++ b/tests/regression/bugzilla/PR58.java @@ -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); + } + } } -- 2.25.1