JDK-8166633 : Enhance exception message where a class name is included to include module/loader info
  • Type: Enhancement
  • Component: core-libs
  • Affected Version: 9
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2016-09-23
  • Updated: 2018-09-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Comments
A preliminary proposal is being discussed to include the loader name where appropriate. While looking at a few existing messages, several messages are not particularly easy to parse and determine the problem and reason. Alex Buckley suggests this format: ERROR: PROBLEM (REASON) where the PROBLEM is aggressively simple (and definitely avoids arbitrary-length loader names) so the REASON bears all the cost of explaining the PROBLEM. If REASON starts by qualifying things precisely, then it can conclude by using the less-qualified names of those things. The following are examples adopting the above format: class test.IAE1_B cannot access its superinterface test.IAE1_A (test.IAE1_B in unnamed module of loader com.acme.MySameClassLoader @423aefd2; test.IAE1_A in unnamed module of loader 'app') class p1.C1 cannot access private method p2.C2.method2()V (p1.C1 in module m1x@2.0 of loader 'app'; p2.C2 in module m2x@9.0 of loader 'app') class p.C cannot access class jdk.internal.misc.VM (p.C in unnamed module of loader 'Cool lib loader' @4567; jdk.internal.misc.VM in module java.base; java.base does not export jdk.internal.misc to the unnamed module) loader constraint violation for type pkg.Foo: class pkg.Child tried to access pkg.Parent._field1, a field of type pkg.Foo, but pkg.Child and pkg.Parent see different definitions of pkg.Foo (pkg.Child in unnamed module of loader pkg.ClassLoaderForChildGrandFoo @123, parent loader 'app'; pkg.Parent in unnamed module of loader pkg.ClassLoaderForParentFoo @456, parent loader 'app') The format of the loader info in an exception message is as follows: If the loader name is explicitly specified then ... of loader '<name>' @<id> If the loader name is not explicitly specified ... of loader <qualified-type-name> @<id> - single-quote denotes it's explicitly specified loader name. The loader name explicitly specified may contain whitespace. - @<id> can distinct different instances with the same loader name or of the same type. - omit @<id> for built-in loaders
07-06-2018

We should audit the exceptions thrown by the VM and the libraries and check their consistency.
25-10-2016