eclipse-jdt / eclipse-jdt/eclipse.jdt.core

ECJ Batch compiler does not fail when `--release` and `--bootclasspath` or `--system` is specified

Open
#1,903 0 comments 0 reactions 0 assignees View on GitHub
javac
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

When `--release` is specified in the compile options then `javac` fails if either `--bootclasspath` or `--system` is given.

javac gives an error:
```sh
❯ cat compile.params
-bootclasspath
remotejdk_11/platformclasspath.jar
-d
bin
-s
src-gen
--system
remotejdk_11
-verbose
--release
8
-proc:none
src/allow.java

❯ remotejdk_21/bin/javac @compile.params
error: option --boot-class-path cannot be used together with --release
error: option --system cannot be used together with --release
Usage: javac
use --help for a list of possible options
```

ECJ attempts compilation but fails with weird errors, which looks like JDK class are not found:
```sh
❯ remotejdk_21/bin/java -jar ecj-4.30.jar @compile.params
[parsing /Users/gwagenknecht/Development/Salesforce/bazel/bazel-jdt-java-toolchain/ecj-test/src/allow.java - #1/1]
[analyzing /Users/gwagenknecht/Development/Salesforce/bazel/bazel-jdt-java-toolchain/ecj-test/src/allow.java - #1/1]
[completed /Users/gwagenknecht/Development/Salesforce/bazel/bazel-jdt-java-toolchain/ecj-test/src/allow.java - #1/1]
[1 unit compiled]
----------
1. ERROR in /Users/gwagenknecht/Development/Salesforce/bazel/bazel-jdt-java-toolchain/ecj-test/src/allow.java (at line 1)
import java.io.FileDescriptor;
^
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
----------
...
```

To reproduce you can use the following steps:
```sh
❯ git clone git@github.com:salesforce/bazel-jdt-java-toolchain.git
❯ cd bazel-jdt-java-toolchain
❯ git switch gunnar/ecj430
❯ cd ecj-test
❯ ./test-compile.sh @compile.params
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.