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

    Details

    • Subcomponent:
    • Resolved In Build:
      b14
    • CPU:
      generic
    • OS:
      generic

      Description

      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();

        Attachments

          Activity

            People

            • Assignee:
              coleenp Coleen Phillimore
              Reporter:
              twisti Christian Thalinger
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: