Proposal: #ClassLoaderNames

David M. Lloyd david.lloyd at
Mon Sep 12 15:54:51 UTC 2016

On 09/12/2016 10:12 AM, Mark Reinhold wrote:
> Issue summary
> -------------
>   #ClassLoaderNames --- Enhance class loaders to have optional names, so
>   that external module systems can provide better diagnostics.  When the
>   run-time system generates a stack trace or an exception message that
>   mentions a module name and version, if present, then it should also
>   insert the name of that module's class loader, if present. [1]
> Proposal
> --------
> Add a string-returning `getName()` method to `java.lang.ClassLoader`
> along with a new constructor with which the name can be specified.  If a
> name is not specified when a class loader is created then it will have no
> name, i.e., the `getName` method will return `null`.  Add corresponding
> constructors to `` and
> ``.
> Extend `java.lang.StackTraceElement` so that a stack-trace element can
> include the name of the relevant class loader, and revise its `toString`
> method to convey that name when present.
> Arrange for the built-in platform and application class loaders to have
> the names `"platform"` and `"app"`, respectively.  (The bootstrap class
> loader cannot be given a name since it is not reified as a `ClassLoader`
> object.)
> [1]

Looks great.  This will be very useful!


More information about the jpms-spec-experts mailing list