RFR: 8222144: Lazily create JRT code source URLs for LoadedModules

Claes Redestad claes.redestad at oracle.com
Tue Apr 9 09:28:42 UTC 2019

Hi Alan,

On 2019-04-09 08:42, Alan Bateman wrote:
> On 08/04/2019 22:42, Claes Redestad wrote:
>> Hi,
>> currently we eagerly convert code source URIs to URLs to avoid recursive
>> bootstrap issues with overrideable URL handlers. The JRT scheme handler
>> is not overrideable, however, and also commonly used for all system
>> modules. Creating these URLs lazily is a reasonable startup
>> optimization since most applications will only ever load from a small
>> fraction of the resolved system modules.
>> Bug:    https://bugs.openjdk.java.net/browse/JDK-8222144
>> Webrev: http://cr.openjdk.java.net/~redestad/8222144/open.00/
> This looks good, a minor nit is that L127 can be if (uri != null && 
> "jrt".equals(...)).

Thanks! And done.

> We could extend it to "file" too because that scheme 
> can't be overridden either.

We agreed offline that this is not worthwhile: in the context of loaded
modules, "file" is used only for exploded modules, where loading will
trigger file system scanning etc, drowning out any micro-optimizations
like this. So it wouldn't help much in those cases, and adds minute
overhead to the common case where most/all modules are "jrt"



> At some point we need to clean up the "may be null" comment as all 
> modules in the boot layer have a location. Also the set of schemes is 
> limited to jrt, file and jar so we are guaranteed to have a protocol 
> handler (if MalformedURLException or IAE is thrown then something is 
> broken elsewhere).
> -Alan

More information about the core-libs-dev mailing list