Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8023697

failed class resolution reports different class name in detail message for the first and subsequent times

XMLWordPrintable

    • b14
    • generic
    • generic

        As shown in JDK-8023122 subsequent failed class resolution attempts have different detail messages:

        $ cat ExtTest.java
        class ExtTest {
            public static void main(String args[]) {
        try {
        Property p = new Property();
        } catch (NoClassDefFoundError e) {
        System.out.println(e);
        }
        try {
        Property p = new Property();
        } catch (NoClassDefFoundError e) {
        System.out.println(e);
        }
            }
        }

        $ java -Xint ExtTest
        java.lang.NoClassDefFoundError: PropertyChild
        java.lang.NoClassDefFoundError: Property

        The fix would be to report the to-be resolved class in the initial exception as well:

        diff -r acedd49a1bce src/share/vm/classfile/systemDictionary.cpp
        --- a/src/share/vm/classfile/systemDictionary.cpp Thu Aug 08 03:16:56 2013 +0200
        +++ b/src/share/vm/classfile/systemDictionary.cpp Fri Aug 23 16:09:04 2013 -0700
        @@ -385,7 +385,7 @@ Klass* SystemDictionary::resolve_super_o
           }
           if (HAS_PENDING_EXCEPTION || superk_h() == NULL) {
             // can null superk
        - superk_h = KlassHandle(THREAD, handle_resolution_exception(class_name, class_loader, protection_domain, true, superk_h, THREAD));
        + superk_h = KlassHandle(THREAD, handle_resolution_exception(child_name, class_loader, protection_domain, true, superk_h, THREAD));
           }
         
           return superk_h();

              coleenp Coleen Phillimore
              twisti Christian Thalinger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: