JEP 330 and MemoryClassLoader.getResourceAsStream
seth lytle
seth.lytle at gmail.com
Wed Aug 22 06:07:28 UTC 2018
i'm working on adding JEP 330 single-file source invocation support to
kilim (an ASM-based continuations library for java for which i'm the
primary maintainer). we're prepping to promote my fork to the main site
and i'd like to be able to support java 11 single-file source invocation as
easily as classpath-based invocation, or at least confirm that the
differences are intentional
- i need access to the bytecode to weave it at runtime
- MemoryClassLoader doesn't provide getResourceAsStream
- it does cache the bytecode, so providing this appears to be easy to
implement
- currently, i access it with a javaagent that mimics MemoryClassLoader.map
- https://github.com/nqzero/kilim/#java-versions
- getResource is also missing, and again, much of the plumbing appears to
be in place
- i haven't tried manually building the "memory:///" style urls
an example of my current invocation:
cp=$(mvn -q dependency:build-classpath -Dmdep.outputFile=/dev/fd/1)
$java11/bin/java -javaagent:${cp/:*} -cp $cp Xorshift.java
what i'd like to be able to do:
$java11/bin/java -cp $cp Xorshift.java
i saw a previous thread that mentioned getResource in passing but no
discussion of whether it was considered (un)desirable. is this feature
planned ? are there problems with introducing it ?
thanks for the great addition to java - using JEP 330 feels fun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180822/44d62646/attachment.html>
More information about the compiler-dev
mailing list