Skip to content

Commit

Permalink
Check ct.sym first before falling back to jrt
Browse files Browse the repository at this point in the history
Since Turbine is used via a GraalVM native image in Bazel, jrt is not
enabled, so looking up the bootclasspath that way doesn't work.

As of Java 22, ct.sym contains signatures for all supported JDKs, so
there is no need to look in jrt.

Partial fix for bazelbuild/bazel#21895
  • Loading branch information
srdo-humio committed Apr 9, 2024
1 parent 74c2c36 commit 2a48a7d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions java/com/google/turbine/main/Main.java
Expand Up @@ -301,16 +301,16 @@ private static ClassPath bootclasspath(TurbineOptions options) throws IOExceptio
}

if (release.isPresent()) {
if (release.getAsInt() == Integer.parseInt(JAVA_SPECIFICATION_VERSION.value())) {
// Search ct.sym for a matching release
ClassPath bootclasspath = CtSymClassBinder.bind(release.getAsInt());
if (bootclasspath != null) {
return bootclasspath;
} else if (release.getAsInt() == Integer.parseInt(JAVA_SPECIFICATION_VERSION.value())) {
// if --release matches the host JDK, use its jimage instead of ct.sym
return JimageClassBinder.bindDefault();
}
// ... otherwise, search ct.sym for a matching release
ClassPath bootclasspath = CtSymClassBinder.bind(release.getAsInt());
if (bootclasspath == null) {
} else {
throw new UsageException("not a supported release: " + release);
}
return bootclasspath;
}

if (options.system().isPresent()) {
Expand Down

0 comments on commit 2a48a7d

Please sign in to comment.