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)
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)
- relates to
-
JDK-8218851 JVM crash in custom classloader stress test, JDK 12 & 13
- Resolved
-
JDK-8166633 Enhance exception message where a class name is included to include module/loader info
- Open
-
JDK-8169559 Add class loader names to relevant VM messages
- Resolved