Request Review: JDK-6479237 (cl) Add support for classloader names
Brent Christian
brent.christian at oracle.com
Thu Oct 27 22:28:42 UTC 2016
Hi, Mandy
It looks pretty good to me. Just a couple small things:
* StackTraceElement.java
379 ClassLoader loader = cls.getClassLoader0();
It looks as if 'loader' isn't used...?
* Throwable.java
832 // VM to fill in StackTraceElement
833 getStackTraceElements(stackTrace);
834 // ensure the proper StackTraceElement initialization
835 for (StackTraceElement ste : stackTrace) {
836 ste.buildLoaderModuleClassName();
837 }
For my own curiosity, why is this buildLoaderModuleClassName() call needed?
Thanks,
-Brent
On 10/25/16 4:10 PM, Mandy Chung wrote:
> Webrev at:
> http://cr.openjdk.java.net/~mchung/jdk9/webrevs/6479237/webrev.00/
>
> Specdiff:
> http://cr.openjdk.java.net/~mchung/jdk9/webrevs/6479237/specdiff/overview-summary.html
>
> This is a long-standing RFE for adding support for class
> loader names. It's #ClassLoaderNames on JSR 376 issue
> list where the proposal [1] has been implemented in jake
> for some time. This patch brings this change to jdk9.
>
> A short summary:
> - New constructors are added in ClassLoader, SecureClassLoader
> and URLClassLoader to specify the class loader name.
>
> - New ClassLoader::getName and StackTraceElement::getClassLoaderName
> method
>
> - StackTraceElement::toString is updated to include the name
> of the class loader and module of that frame in this format:
> <loader>/<module>/<fully-qualified-name>(<src>:<line>)
>
> The detail is in StackTraceElement::buildLoaderModuleClassName
> that compress the output string for cases when the loader
> has no name or the module is unnamed module. Another thing
> to mention is that VM sets the Class object when filling in
> a stack trace of a Throwable object. Then the library will
> build a String from the Class object for serialization purpose.
>
> Mandy
> [1] http://mail.openjdk.java.net/pipermail/jpms-spec-observers/2016-September/000550.html
>
More information about the hotspot-runtime-dev
mailing list