From 5637a07740c7117adcba19a718b88de8344bba92 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 12 Apr 2024 14:55:14 -0700 Subject: [PATCH] No-op refactor after unknown commit PiperOrigin-RevId: 624300376 --- java/com/google/turbine/main/Main.java | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/java/com/google/turbine/main/Main.java b/java/com/google/turbine/main/Main.java index 86d7339..3725834 100644 --- a/java/com/google/turbine/main/Main.java +++ b/java/com/google/turbine/main/Main.java @@ -83,7 +83,7 @@ public final class Main { static final Attributes.Name TARGET_LABEL = new Attributes.Name("Target-Label"); static final Attributes.Name INJECTING_RULE_KIND = new Attributes.Name("Injecting-Rule-Kind"); - public static void main(String[] args) throws IOException { + public static void main(String[] args) { boolean ok; try { compile(args); @@ -218,7 +218,7 @@ public static Result compile(TurbineOptions options) throws IOException { } } if (options.output().isPresent()) { - Map transitive = Transitive.collectDeps(bootclasspath, bound); + ImmutableMap transitive = Transitive.collectDeps(bootclasspath, bound); writeOutput(options, bound.generatedClasses(), lowered.bytes(), transitive); } if (options.outputManifest().isPresent()) { @@ -301,16 +301,7 @@ private static ClassPath bootclasspath(TurbineOptions options) throws IOExceptio } if (release.isPresent()) { - // 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(); - } else { - throw new UsageException("not a supported release: " + release); - } + return release(release.getAsInt()); } if (options.system().isPresent()) { @@ -322,6 +313,19 @@ private static ClassPath bootclasspath(TurbineOptions options) throws IOExceptio return ClassPathBinder.bindClasspath(toPaths(options.bootClassPath())); } + private static ClassPath release(int release) throws IOException { + // Search ct.sym for a matching release + ClassPath bootclasspath = CtSymClassBinder.bind(release); + if (bootclasspath != null) { + return bootclasspath; + } + if (release == Integer.parseInt(JAVA_SPECIFICATION_VERSION.value())) { + // if --release matches the host JDK, use its jimage + return JimageClassBinder.bindDefault(); + } + throw new UsageException("not a supported release: " + release); + } + /** Parse all source files and source jars. */ // TODO(cushon): parallelize private static ImmutableList parseAll(TurbineOptions options) throws IOException {