Re: JEP 330 class loader getResourceAsStream

2018-08-27 Thread Jonathan Gibbons
On 8/27/18 10:51 AM, Peter Levart wrote: On 08/27/2018 04:47 PM, David Lloyd wrote: On Mon, Aug 27, 2018 at 9:41 AM Alan Bateman wrote: On 24/08/2018 18:27, David Lloyd wrote: Why not go ahead and implement getResource as well?  It's not *that* big of a deal to add a URL handler, and it

Re: JEP 330 class loader getResourceAsStream

2018-08-27 Thread Alan Bateman
On 27/08/2018 18:49, Jonathan Gibbons wrote: Alan, It looks like we don't even need to register a URLStreamHandlerProvider, we can provide the URLStreamHandler when we create the URL. :-) This will only work for URL objects returned by getResource. If you create the URL by other means, and

Re: JEP 330 class loader getResourceAsStream

2018-08-27 Thread Peter Levart
On 08/27/2018 04:47 PM, David Lloyd wrote: On Mon, Aug 27, 2018 at 9:41 AM Alan Bateman wrote: On 24/08/2018 18:27, David Lloyd wrote: Why not go ahead and implement getResource as well? It's not *that* big of a deal to add a URL handler, and it would be a fairly trivial one. Right, it

Re: JEP 330 class loader getResourceAsStream

2018-08-27 Thread Alan Bateman
On 27/08/2018 15:47, David Lloyd wrote: : AFAIK any code would expect that resources available as streams would generally also be available as URLs. I'm not sure that distinguishing between basic and advanced code really clarifies anything in terms of the question. I think you've mis-read my

Re: JEP 330 class loader getResourceAsStream

2018-08-27 Thread Jonathan Gibbons
This is now being tracked in JDK-8210009. https://bugs.openjdk.java.net/browse/JDK-8210009 -- Jon On 8/27/18 10:24 AM, seth lytle wrote: david lloyd wrote: AFAIK any code would expect that resources available as streams would generally also be available as URLs starting with java 9, the

Re: JEP 330 class loader getResourceAsStream

2018-08-27 Thread seth lytle
david lloyd wrote: > AFAIK any code would expect that resources available as streams would > generally also be available as URLs starting with java 9, the javadocs for getResource (but not for getResourceAsStream) specifically allow returning null if "a URL could not be constructed to locate the

Re: JEP 330 class loader getResourceAsStream

2018-08-27 Thread David Lloyd
On Mon, Aug 27, 2018 at 9:41 AM Alan Bateman wrote: > > On 24/08/2018 18:27, David Lloyd wrote: > > Why not go ahead and implement getResource as well? It's not *that* > > big of a deal to add a URL handler, and it would be a fairly trivial > > one. > Right, it wouldn't be too hard but it would

Re: JEP 330 class loader getResourceAsStream

2018-08-27 Thread Alan Bateman
On 24/08/2018 18:27, David Lloyd wrote: Why not go ahead and implement getResource as well? It's not *that* big of a deal to add a URL handler, and it would be a fairly trivial one. Right, it wouldn't be too hard but it would require a bit of plumbing to have it backed by the Memory* classes

Re: JEP 330 class loader getResourceAsStream

2018-08-24 Thread David Lloyd
Why not go ahead and implement getResource as well? It's not *that* big of a deal to add a URL handler, and it would be a fairly trivial one. On Fri, Aug 24, 2018 at 12:21 PM seth lytle wrote: > > JEP 330 (launch single-file source programs) uses a MemoryClassLoader. the > compiled bytecode is

JEP 330 class loader getResourceAsStream

2018-08-24 Thread seth lytle
JEP 330 (launch single-file source programs) uses a MemoryClassLoader. the compiled bytecode is stored in byte arrays in memory and is never written to file. currently, the bytecode is not exposed as resources and it would be advantageous to do so (enabling the use of eg ASM to modify the classes