From 04445b15661c94fc1dac7b4b6ff8119f1de4f768 Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Mon, 20 Jun 2022 09:37:51 +0200 Subject: [PATCH] chore revert fix for #615 and apply sbt/sbt#5522 --- .../java/sbt_inc/SbtIncrementalCompiler.java | 13 ++++--------- src/main/java/util/JavaVersion.java | 19 ------------------- 2 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 src/main/java/util/JavaVersion.java diff --git a/src/main/java/sbt_inc/SbtIncrementalCompiler.java b/src/main/java/sbt_inc/SbtIncrementalCompiler.java index e44bbeb0..faf3bd31 100644 --- a/src/main/java/sbt_inc/SbtIncrementalCompiler.java +++ b/src/main/java/sbt_inc/SbtIncrementalCompiler.java @@ -29,8 +29,6 @@ import scala.Tuple2; import scala_maven.MavenArtifactResolver; import util.FileUtils; -import util.JavaVersion; -import xsbti.FileConverter; import xsbti.PathBasedFile; import xsbti.T2; import xsbti.VirtualFile; @@ -118,7 +116,9 @@ public Optional analysis(VirtualFile classpathEntry) { @Override public DefinesClass definesClass(VirtualFile classpathEntry) { - return Locate.definesClass(classpathEntry); + return classpathEntry.name().equals("rt.jar") + ? className -> false + : Locate.definesClass(classpathEntry); } }; @@ -158,11 +158,6 @@ public void compile( fullClasspath.add(classesDirectory); fullClasspath.addAll(classpathElements); - Optional fileConverter = - JavaVersion.JAVA_MAJOR_VERSION >= 9 - ? Optional.empty() - : Optional.of(PlainVirtualFileConverter.converter()); - CompileOptions options = CompileOptions.of( fullClasspath.stream() @@ -176,7 +171,7 @@ public void compile( pos -> pos, // sourcePositionMappers compileOrder, // order Optional.empty(), // temporaryClassesDirectory - fileConverter, // _converter + Optional.empty(), // _converter Optional.empty(), // _stamper Optional.empty() // _earlyOutput ); diff --git a/src/main/java/util/JavaVersion.java b/src/main/java/util/JavaVersion.java deleted file mode 100644 index 22d22499..00000000 --- a/src/main/java/util/JavaVersion.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * This is free and unencumbered software released into the public domain. - * See UNLICENSE. - */ -package util; - -public final class JavaVersion { - - private JavaVersion() {} - - public static final int JAVA_MAJOR_VERSION; - - static { - String javaSpecVersion = System.getProperty("java.specification.version"); - String[] components = javaSpecVersion.split("\\."); - int component0 = Integer.parseInt(components[0]); - JAVA_MAJOR_VERSION = component0 == 1 ? Integer.parseInt(components[1]) : component0; - } -}