[HN Gopher] Show HN: Standalone Jdk.compiler, Java Compiler Fram...
___________________________________________________________________
Show HN: Standalone Jdk.compiler, Java Compiler Framework and Tree
API
With this standalone compiler, you can rely on all Java 11 javac
features to be available, even when using newer Java versions.
Specifically, this allows you to: - compile code even if your Java
environment isn't a full JDK (Java JRE, for example!) - target
Java 1.7 for compilation without any warnings or restrictions. -
use the Compiler Tree API without resorting to --add-opens trickery
that may eventually fail in newer Java releases - build a modified
compiler with additional features or custom tweaks I made this
after finding that the otherwise superb "jsweet" Java-to-JavaScript
transpiler failed to build and run with Java 16 or newer.
Surprisingly, I couldn't find any prior work other than "proper"
standalone compilers like Eclipse's ecj that would properly work
with modern Java runtimes. I'm excited to see what can be done now
that we have this scaffolding.
Author : kohlschuetter
Score : 32 points
Date : 2023-10-10 16:45 UTC (6 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| [deleted]
| koito17 wrote:
| In the repository, I see
|
| > By adding support for GraalVM native image, we could build
| javac binaries with custom configurations
|
| Can you elaborate on what's missing for GraalVM native image
| support? Is there a particular behavior of javac (e.g.
| reflection, dynamic class loading, keeping threads alive at
| compile-time, ...) that is a show stopper for native image
| compatibility?
|
| Overall this project looks cool, and native-image support may
| allow integration into tools like Babashka to do some crazy
| things like downloading Java source from somewhere then compiling
| and loading it into the running image.
| kohlschuetter wrote:
| I think native image support is actually trivial to implement,
| it's just not done yet since it wasn't a priority.
|
| There are indeed some reflection calls that need to be
| configured via META-INF/native-image config files, but nothing
| out of the ordinary.
___________________________________________________________________
(page generated 2023-10-10 23:00 UTC)