JDK-8210009 : Source Launcher classloader should support getResource and getResourceAsStream
Type:Enhancement
Component:tools
Sub-Component:javac
Affected Version:11
Priority:P3
Status:Closed
Resolution:Fixed
Submitted:2018-08-27
Updated:2019-01-08
Resolved:2018-09-06
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The MemoryClassLoader does not currently implement getResourceAsStream and getResource.
It would facilitate some advanced usages if it did.
See email threads on compiler-dev and core-libs-dev.
Comments
Providing getResourceAsStream is simple.
Providing getResource will require providing a URLStreamHandler for a custom URL protocol, which can easily be done with the appropriate URL constructor:
URL���(String protocol, String host, int port, String file, URLStreamHandler handler)
https://docs.oracle.com/javase/9/docs/api/java/net/URL.html#URL-java.lang.String-java.lang.String-int-java.lang.String-java.net.URLStreamHandler-