RFR: 8237878: Improve ModuleLoaderMap datastructures

Claes Redestad claes.redestad at oracle.com
Mon Feb 10 09:04:49 UTC 2020



On 2020-02-09 17:49, Alan Bateman wrote:
> On 06/02/2020 13:48, Claes Redestad wrote:
>> :
>>
>> New webrev:
>>
>> http://cr.openjdk.java.net/~redestad/8237878/open.01/
> The archiving looks good but I'd prefer if this patch didn't change the 
> usages of Function<String, ClassLoader> to ModuleLoaderMap.Mapper - 
> that's an implementation class that should not be used outside of the 
> ModuleLoaderMap (it should be private but there is special check in the 
> Module code that prevents this).

Ok, makes sense to make this private - I guess we could refactor the
instanceof in Module to call a function on ModuleLoaderMap to
encapsulate this better. Hoisting the check from the loop is a small
optimization for the bootstrap case, regardless.

> 
> The ModuleLoaderMap constructor needs a comment so that future 
> maintainers know that it maps the modules in the given configuration to 
> the built-in class loaders. Also would be good if the declaration of map 
> were changed back to Map<String, Integer> and a // comment to make it 
> clear that it maps the module name to an index.

So how about:
http://cr.openjdk.java.net/~redestad/8237878/open.02/

/Claes


More information about the core-libs-dev mailing list