Closed snicoll closed 3 hours ago
AFAIK ct.sym
is not a part of a JRE but JDK only, but it is essential to support --release
option as it contains all the past API signatures.
With that, you can't use JRE if you want use --release
Thanks for the quick feedback and I suspected as much. Don't you want to fix the NPE and provide something more meaningful to users?
Could you please try the latest version from https://download.eclipse.org/eclipse/downloads/drops4/I20241119-0600/? The code is changed meanwhile (stack doesn't match current master), not sure f we handle it differently now.
With 3.40.0-SNAPSHOT
(ecj-3.40.0-20241117.122305-150.jar
specifically)
java.lang.NullPointerException: Cannot invoke "java.nio.file.FileSystem.getPath(String, String[])" because "this.fs" is null
at org.eclipse.jdt.internal.compiler.batch.ClasspathJep247Jdk12.findClass(ClasspathJep247Jdk12.java:95)
at org.eclipse.jdt.internal.compiler.batch.ClasspathJsr199.findClass(ClasspathJsr199.java:81)
at org.eclipse.jdt.internal.compiler.batch.FileSystem.internalFindClass(FileSystem.java:512)
at org.eclipse.jdt.internal.compiler.batch.FileSystem.findClass(FileSystem.java:443)
at org.eclipse.jdt.internal.compiler.batch.FileSystem.findType(FileSystem.java:602)
at org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment.findType(IModuleAwareNameEnvironment.java:100)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createPlainPackage(LookupEnvironment.java:1177)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:145)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:524)
at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:900)
at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:415)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:469)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:447)
at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:4684)
at org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl.call(EclipseCompilerImpl.java:98)
at org.eclipse.jdt.internal.compiler.tool.EclipseCompiler$2.call(EclipseCompiler.java:196)
at com.example.demo.DemoJep247JreApplication.compile(DemoJep247JreApplication.java:37)
at com.example.demo.DemoJep247JreApplication.main(DemoJep247JreApplication.java:104)
You can reproduce the problem using https://github.com/snicoll-scratches/demo-jep247-jre. It has a
README
that explains the commands to invoke to reproduce. I have tried on various JRE distributions.The TL;DR is that the Eclipse Compiler does not seem to support the use of
--release
when running in a JRE. Here's the combination that I tested:--release 17
with JRE 17: works--release 17
with JDK 17: works--release 17
with JRE 21: does not work--release 17
with JDK 21: worksWhen we opt-in for JRE 247 on a JRE that's more recent that the target release, the error is as follows:
Debugging this happens when
ClasspathJep247Jdk12
operates on thelib/jrt-fs.jar
of the JRE distribution. I believe theFileSystem
is not initialized asPath filePath = this.jdkHome.toPath().resolve("lib").resolve("ct.sym");
is not found.Let me know if you need more details.