Request Review: JDK-6479237 (cl) Add support for classloader names

David M. Lloyd david.lloyd at redhat.com
Thu Oct 27 14:30:07 UTC 2016


It looks like if you have a class loader name but not a module (i.e. 
it's unnamed), you get output that looks like this:

         [...]
         at 
org.jboss.as.controller//org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:390)
         [...]

In this case the classloader's name is "org.jboss.as.controller".  Is 
the double-slash "//" intended?

On 10/25/2016 06: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
>

-- 
- DML


More information about the jigsaw-dev mailing list