Skip to content

Commit 3078f4d

Browse files
committed
Clean up Java 17 fixes
1 parent fad0baa commit 3078f4d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/GradleBuildTool.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,8 @@ class GradleBuildTool(index: IndexCommand) extends BuildTool("Gradle", index) {
126126
}
127127

128128
private def initScript(toolchains: GradleJavaToolchains, tmp: Path): Path = {
129-
val executableJavacPath = toolchains.executableJavacPath()
130129
val executable =
131-
executableJavacPath match {
130+
toolchains.executableJavacPath() match {
132131
case Some(path) =>
133132
s"options.forkOptions.executable = '$path'"
134133
case None =>
@@ -161,7 +160,6 @@ class GradleBuildTool(index: IndexCommand) extends BuildTool("Gradle", index) {
161160
| tasks.withType(JavaCompile) {
162161
| options.fork = true
163162
| options.incremental = false
164-
| System.out.println("JAVA VERSION " + System.getProperty("java.version"))
165163
| $executable
166164
| }
167165
| }

scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/MavenBuildTool.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class MavenBuildTool(index: IndexCommand) extends BuildTool("Maven", index) {
4141
index.workingDirectory,
4242
index.finalTargetroot(defaultTargetroot),
4343
tmp,
44-
// TODO: infer Java version from `java -version` because it may not
45-
// match the Java version that's used by the current process.
4644
GradleJavaToolchains.isJavaAtLeast(SystemJavaVersion.detect(), "11")
4745
)
4846
buildCommand ++=

scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/SystemJavaVersion.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import java.nio.file.Files
55
import com.sourcegraph.scip_java.Embedded
66

77
object SystemJavaVersion {
8+
// Returns the output of `System.getProperty("java.version")` from a fresh JVM
9+
// instance using the system JVM installation. We can't use this process since
10+
// it may be running on a separate JVM process (that's the case when we run
11+
// `sbt test` in this build at least).
812
def detect(): String = {
913
val tmp = Files.createTempDirectory("java-version")
1014
val jar = Embedded.semanticdbJar(tmp)

0 commit comments

Comments
 (0)