RFR(M): 8199852: Print more information about class loaders in LinkageErrors.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Wed Mar 21 13:34:41 UTC 2018


Hi David, 

I put that description into the bug:
https://bugs.openjdk.java.net/browse/JDK-8199852
I thought it should be better archived than in the mail thread.

The change you mention below is intentional. There are two 
different loaders involved, and so far only one of them was printed.
I tried to put "different type" info more detailed wording, too (different
class with the same name).

Unfortunately I could not come up with a test for the messages
in klassVtable.cpp, but there I just removed the "instance of", 
that appears in the printed message if the classloader has a name.

Any advice when there should be "" in the message? I normalized
it so that only the user-definable names are quoted. I removed
the "" from around classnames, methods etc.

Best regards,
  Goetz.


> -----Original Message-----
> From: David Holmes [mailto:david.holmes at oracle.com]
> Sent: Mittwoch, 21. März 2018 14:12
> To: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>; hotspot-runtime-
> dev at openjdk.java.net
> Subject: Re: RFR(M): 8199852: Print more information about class loaders in
> LinkageErrors.
> 
> Hi Goetz,
> 
> Can you provide a detailed comparison of all the before and after
> messages please. It seems to me you are rewriting some of the messages
> in a way that changes the meaning.
> 
> src/hotspot/share/classfile/systemDictionary.cpp
> 
> Before:
> 
> !         linkage_error1 = "loader constraint violation: loader
> (instance of ";
> !         linkage_error2 = ") previously initiated loading for a
> different type with name \"";
> 
> after:
> 
> !         linkage_error1 = "loader constraint violation: loader ";
> !         linkage_error2 = " wants to load class ";
> !         linkage_error3 = ". A different class with the same name was
> previously loaded by ";
> 
> this does not describe the same situation!
> 
> Thanks,
> David
> 
> On 21/03/2018 9:55 PM, Lindenmaier, Goetz wrote:
> > Hi,
> >
> > ClassLoaders have a field containing a name since Java 9.
> >
> > This change improves some of the messages of LinkageErrors to
> > print the name of the loader involved, as well as the parent of the loader.
> > This simplifies tracking down the component causing an error in large
> > Java systems.
> >
> > Please review:
> > http://cr.openjdk.java.net/~goetz/wr18/8199852-
> exMsg_Linkage/01/index.html
> >
> > I ran this through all our tests (jck, jtreg, spec etc).  I will run it through
> submit-hs
> > (or jdk/submit) once it's reviewed.
> >
> > Best regards,
> >    Goetz.
> >
> >
> >
> >


More information about the hotspot-runtime-dev mailing list