{"by":"kohlschuetter","descendants":13,"id":37834437,"kids":[37838182,37839439,37843643,37839485,37835875],"score":69,"text":"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:<p>- compile code even if your Java environment isn&#x27;t a full JDK (Java JRE, for example!)<p>- target Java 1.7 for compilation without any warnings or restrictions.<p>- use the Compiler Tree API without resorting to --add-opens trickery that may eventually fail in newer Java releases<p>- build a modified compiler with additional features or custom tweaks<p>I made this after finding that the otherwise superb &quot;jsweet&quot; Java-to-JavaScript transpiler failed to build and run with Java 16 or newer. Surprisingly, I couldn&#x27;t find any prior work other than &quot;proper&quot; standalone compilers like Eclipse&#x27;s ecj that would properly work with modern Java runtimes.<p>I&#x27;m excited to see what can be done now that we have this scaffolding.","time":1696956347,"title":"Show HN: Standalone Jdk.compiler, Java Compiler Framework and Tree API","type":"story","url":"https://github.com/kohlschutter/jdk.compiler.standalone"}