Skip to content

Version.getCurrent() broken for distributions not modifying the base JDK #6379

@jerboaa

Description

@jerboaa

Describe the issue
After #6302 the org.graalvm.version property is no longer being passed on to the native image generator. Specifically this line and this line are problematic for distros not using jlink or otherwise modifying the base JDK from upstream OpenJDK, and thus not having a release file with GRAALVM_VERSION in it.

Steps to reproduce the issue

$ cat VersionTest.java
import org.graalvm.home.Version;
public class VersionTest {
        private static final String VERSION = Version.getCurrent().toString();
	public static void main(String[] args) {
		System.out.println(VERSION);
	}
}
$ javac -cp $GRAALVM_HOME/lib/jvmci/graal-sdk.jar VersionTest.java
$ native-image --initialize-at-build-time=. VersionTest
[...]
$ ./versiontest
snapshot

Describe GraalVM and your environment:
Mandrel build of graal master after #6302 with org.graalvm.version set in native-image bash launcher.

Actual Results
Always prints snapshot

Expected Results
The actual version in use, (i.e. 23.1.0-dev) for the build I've tested with.

native-image 17.0.6 2023-01-17
OpenJDK Runtime Environment Mandrel-23.1.0-dev (build 17.0.6+10)
OpenJDK 64-Bit Server VM Mandrel-23.1.0-dev (build 17.0.6+10, mixed mode)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions