-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Not sure if this a native-image issue. Please transfer to where it's most appropriate.
Issue Description:
The org.graalvm.sdk:graal-sdk in version 23.0.0 from maven central is no longer consumable by projects compiling to target level 11 (for JDK 11 compatibility). That is, those projects would have to at least target JDK 17. This used to work with graal-sdk 22.3.x.
Steps to reproduce
git clone https://github.com/jerboaa/reproducers-graal.git && cd reproducers-graal/graal-23-jdk11-compliance-repromvn package
This fails with:
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.871 s
[INFO] Finished at: 2023-06-19T15:46:51+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project version: Compilation failure: Compilation failure:
[ERROR] /home/sgehwolf/Documents/mandrel/bugs/upstream-graal/reproducers-graal/graal-23-jdk11-compliance-repro/src/main/java/version/TargetSub.java:[24,36] cannot access com.oracle.svm.core.annotate.Substitute
[ERROR] bad class file: /home/sgehwolf/.m2/repository/org/graalvm/sdk/graal-sdk/23.0.0/graal-sdk-23.0.0.jar(/com/oracle/svm/core/annotate/Substitute.class)
[ERROR] class file has wrong version 61.0, should be 55.0
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] /home/sgehwolf/Documents/mandrel/bugs/upstream-graal/reproducers-graal/graal-23-jdk11-compliance-repro/src/main/java/version/TargetSub.java:[25,36] cannot access com.oracle.svm.core.annotate.TargetClass
[ERROR] bad class file: /home/sgehwolf/.m2/repository/org/graalvm/sdk/graal-sdk/23.0.0/graal-sdk-23.0.0.jar(/com/oracle/svm/core/annotate/TargetClass.class)
[ERROR] class file has wrong version 61.0, should be 55.0
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] /home/sgehwolf/Documents/mandrel/bugs/upstream-graal/reproducers-graal/graal-23-jdk11-compliance-repro/src/main/java/version/TargetSub.java:[30,2] cannot find symbol
[ERROR] symbol: class TargetClass
[ERROR] /home/sgehwolf/Documents/mandrel/bugs/upstream-graal/reproducers-graal/graal-23-jdk11-compliance-repro/src/main/java/version/TargetSub.java:[34,6] cannot find symbol
[ERROR] symbol: class Substitute
[ERROR] location: class version.TargetSub
Additional info
The change which seems to have introduced this issue is:
#5838
Use case information
The use-case we'd have in mind is this. Be able to run the library with some older JDK, but still have the option to compile the library to native with latest GraalVM (23.0) currently. At the same time, avoid the need to depend on two GraalVM versions to support this. While this substitution example is contrived in the larger framework context those are sometimes needed in order to create leaner apps.
$ java -showversion -jar target/version.jar
openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment (Red_Hat-11.0.19.0.7-2.fc37) (build 11.0.19+7)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.19.0.7-2.fc37) (build 11.0.19+7, mixed mode, sharing)
Sub: Hello!
$ native-image --version
native-image 17.0.7 2023-04-18
GraalVM Runtime Environment GraalVM CE 17.0.7+7.1 (build 17.0.7+7-jvmci-23.0-b12)
Substrate VM GraalVM CE 17.0.7+7.1 (build 17.0.7+7, serial gc)
$ native-image -jar target/version.jar versions
$ ./versions
TargetSub: Hello!