RFR: JDK-8161230 ClassLoader: add resource methods returning java.util.stream.Stream

Patrick Reinhart patrick at reini.net
Thu Sep 8 15:20:47 UTC 2016

On 2016-09-08 09:16, Andrej Golovnin wrote:
> Hi all,
> Maybe I'm wrong but I think the JavaDocs for the new method need more
> love. The JavaDocs mention at multiple places that resources are
> loaded, e.g.:
> 1362      * Returns a stream that loads the resources with the given 
> name.
> 1375      * <p> The loading of resources will occur when the returned 
> stream is
> 1376      * evaluated. If the loading of resources results in an
> {@code IOException}
> In reality however, no resources are loaded. Only URLs for all
> resources that match the given name are created. To load the resources
> you must open the connection on the returned URLs. Therefore I think
> the JavaDocs do not reflect what the method does.

What do you suggest to write instead?

> And one more thing. Because we have now only one method to get a
> stream I think the constant RESOURCE_CHARACTERISTICS should be defined
> inside the #resources()-method. It is not needed to define it as a
> static final field.

The reason is to have the computation of the characteristics only at 
compile time not on each method call.

> Best regards,
> Andrej Golovnin


More information about the core-libs-dev mailing list