RFR: JDK-8210009: Source Launcher classloader should support getResource and getResourceAsStream
mandy chung
mandy.chung at oracle.com
Tue Sep 4 23:31:18 UTC 2018
On 9/4/18 1:52 PM, Jonathan Gibbons wrote:
> Please review a change to add support for the getResource* group of
> methods
> to the internal class loader used by the Source Launcher, introduced
> in JEP 330.
>
> The overall issue has been discussed on OpenJDK lists, [1,2]
>
> The implementation consists of providing findResource and findResources,
> along with a couple of minor additional classes to implement
> URLStreamHandler
> and URLConnection.
>
> There is one implementation detail worthy of note. The "new URL" should
> be inside a doPrivileged block, but overall, the Source Launcher does not
> work when a security manager in installed. This is being tracked as
> JDK-8210274,
> and the appropriate doPrivileged call will be added as part of that fix.
>
> -- Jon
>
> JBS: https://bugs.openjdk.java.net/browse/JDK-8210009
> Webrev: http://cr.openjdk.java.net/~jjg/8210009/webrev.01/
This patch looks okay to me.
This is a reasonable solution to allow getResource* to obtain the class
file bytes
loaded by the source launcher. JEP 330 might document that the URL
protocol
is implementation specific and the only way to get the URL of a .class
file loaded
by the source launcher is via the getResource(s) method. It does not
support
creating such a URL from a string.
Mandy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180904/0895b8b0/attachment.html>
More information about the compiler-dev
mailing list