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

Mandy Chung mandy.chung at oracle.com
Fri Oct 28 02:54:58 UTC 2016


> On Oct 27, 2016, at 3:28 PM, Brent Christian <brent.christian at oracle.com> wrote:
> 
> 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…?

Good catch.  Leftover code.  Removed.

> * 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?

When the VM fills in the stack trace, it sets Class object in StackTraceElement and the buildLoaderModuleClassName() call here to (1) build the output string whose format as described in the javadoc, and stored in a serial form (2) not to hold a strong reference to Class object.  StackTraceElement is serializable and it can’t build the correct string, when deserialized.

Mandy


More information about the jigsaw-dev mailing list