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

Print more information about class loaders in LinkageErrors.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 11
    • hotspot
    • None
    • b13

      Print more information about class loaders in LinkageErrors.
      Since Java 9, class loaders have a name field. Report this if set.
      Also report the parent class loader.

      Changed messages:
      =================

      systemDictionary.cpp,
      ---------------------------

      SystemDictionary::check_constraints()
      message 1:

      before:
      loader (instance of PreemptingClassLoader): attempted duplicate class definition for name: "test/Foo"
      loader (instance of PreemptingClassLoader): attempted duplicate class definition for name: "test/J"

      after:
      loader "<unnamed>" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader) attempted duplicate class definition for test.Foo.
      loader "DuplicateLE_Test_Loader" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader) attempted duplicate class definition for test.Foo.
      loader "DuplicateLE_Test_Loader_IF" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader) attempted duplicate interface definition for test.J.

      Improvements:
       * external names ('.' instead of '/')
       * more detailed loader description (name, class, parent)
       * distinguish classes, interfaces and abstract classes.

      message 2:

      before:
      loader constraint violation: loader (instance of PreemptingClassLoader) previously initiated loading for a different type with name "test/D_ambgs"

      after:
      loader constraint violation: loader "<unnamed>" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader) wants to load class test.D_ambgs. A different class with the same name was previously loaded by "app" (instance of jdk.internal.loader.ClassLoaders$AppClassLoader).

      Improvements:

       * external names ('.' instead of '/')
       * more detailed loader description (name, class, parent)
       * distinguish classes, interfaces and abstract classes.


      klassVtable.cpp:
      ---------------------

      message 3, klassVtable::update_inherited_vtable():

      before:

      loader constraint violation for class test/Task: when selecting overriding method "test.Task.m()Ltest/Foo;" the class loader (instance of PreemptingClassLoader) of the selected method's type test/Task, and the class loader (instance of jdk/internal/loader/ClassLoaders$AppClassLoader) for its super type test/J have different Class objects for the type test/Foo used in the signature

      after:

      loader constraint violation for class test.Task: when selecting overriding method test.Task.m()Ltest/Foo; the class loader "<unnamed>" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader) of the selected method's type test.Task, and the class loader "app" (instance of jdk.internal.loader.ClassLoaders$AppClassLoader) for its super type test.J have different Class objects for the type test.Foo used in the signature

      or

      loader constraint violation for class test.Task: when selecting overriding method test.Task.m()Ltest/Foo; the class loader "VtableLdrCnstrnt_Test_Loader" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader) of the selected method's type test.Task, and the class loader "app" (instance of jdk.internal.loader.ClassLoaders$AppClassLoader) for its super type test.J have different Class objects for the type test.Foo used in the signature

      message 4, klassItable::initialize_itable_for_interface():

      before:

      loader constraint violation in interface itable initialization for class test/C: when selecting method "test.I.m()Ltest/Foo;" the class loader (instance of PreemptingClassLoader) for super interface test/I, and the class loader (instance of jdk/internal/loader/ClassLoaders$AppClassLoader) of the selected method's type, test/J have different Class objects for the type test/Foo used in the signature

      after:

      loader constraint violation in interface itable initialization for class test.C: when selecting method test.I.m()Ltest/Foo; the class loader "<unnamed>" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader) for super interface test.I, and the class loader "app" (instance of jdk.internal.loader.ClassLoaders$AppClassLoader) of the selected method's type, test.J have different Class objects for the type test.Foo used in the signature"

      or

      loader constraint violation in interface itable initialization for class test.C: when selecting method test.I.m()Ltest/Foo; the class loader "ItableLdrCnstrnt_Test_Loader" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader) for super interface test.I, and the class loader "app" (instance of jdk.internal.loader.ClassLoaders$AppClassLoader) of the selected method's type, test.J have different Class objects for the type test.Foo used in the signature

      Improvements:

       * external names ('.' instead of '/')
       * more detailed loader description (name, class, parent)

       * Todo: external name in method signature?!

      linkResolver.cpp:
      ---------------------

      message 5 LinkResolver::check_method_loader_constraints():
      message 6 LinkResolver::check_field_loader_constraints():

      replaced parts mentioning the class loader:

      before:

      the class loader (instance of PreemptingClassLoader)

      after:

      the class loader "<unnamed>" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader)

      or:

      the class loader "My_Test_Loader" (instance of PreemptingClassLoader, child of "app" jdk.internal.loader.ClassLoaders$AppClassLoader)

            goetz Goetz Lindenmaier
            goetz Goetz Lindenmaier
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: