ClassLoader.getResources vs Module.getResourceAsStream

Michał Zegan webczat_200 at poczta.onet.pl
Sat Jul 14 13:00:31 UTC 2018


Hello.
When reading docs for jdk9 and jdk10 it seems that those methods work in
a bit different way when it goes to encapsulation:
Module.getResourceAsStream will retrieve the resource without a problem
if a package is opened to the caller module, probably including the fact
that it will find a resource when the calling module is the same as one
represented by the module object.
But, ClassLoader.getResources and other resource methods seem to require
unconditional package open.
Why? I don't quite understand that distinction.


More information about the jigsaw-dev mailing list