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

Fixes #318

FUTURE_COPYBARA_INTEGRATE_REVIEW=#318 from srdo-humio:stig/check-ct-sym-first 2a48a7d
PiperOrigin-RevId: 622308437
  • Loading branch information
srdo-humio authored and Javac Team committed Apr 9, 2024
1 parent 74c2c36 commit 8cacf8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions java/com/google/turbine/main/Main.java
Original file line number Diff line number Diff line change
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 8cacf8b

Please sign in to comment.