8173393: Module system implementation refresh (2/2017)

Claes Redestad claes.redestad at oracle.com
Wed Feb 8 14:49:31 UTC 2017


Hi,

On 2017-02-08 12:37, Alan Bateman wrote:
>>
>>
>> BuiltinClassLoader
>>>>
>>   925     private ModuleReader moduleReaderFor(ModuleReference mref) {
>>   926         return moduleToReader.computeIfAbsent(mref, m ->
>> createModuleReader(m));
>>   927     }
>>
>> Use this:: createModuleReader
> I'll defer to Claes on this, mostly because #classes triggered to load
> here is observable in startup tests.

 From a startup perspective all alternatives are more or less equal 
here, and generally speaking a lambda and a method reference are equal
as long as they're both non-capturing.

A detail I had missed here, though, is that the createModuleReader
method could be made static to ensure the lambda is actually
non-capturing (otherwise it'll unnecessarily allocate an object
preserving this).

So I'd make createModuleReader static and then pick and choose between
m -> createModuleReader(m) and BuiltinClassLoader::createModuleReader

Thanks!

/Claes


More information about the jigsaw-dev mailing list