Skip to content

Commit

Permalink
fix JavaCompilerSpec with JDK 21
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Oct 8, 2023
1 parent 3f5e423 commit b6ce9ab
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,15 @@ class JavaCompilerSpec extends UnitSpec with Diagrams {
}

def findsErrors(compiler: XJavaTools) = IO.withTemporaryDirectory { out =>
val options = Seq("-deprecation") ++ {
if (scala.util.Properties.isJavaAtLeast("21")) {
Seq("-proc:none")
} else {
Nil
}
}
val (result, problems) =
compile(compiler, Seq(knownSampleErrorFile), Seq("-deprecation"), out.toPath)
compile(compiler, Seq(knownSampleErrorFile), options, out.toPath)
assert(result == false)
assert(problems.size == {
sys.props("java.specification.version") match {
Expand Down Expand Up @@ -226,10 +233,18 @@ class JavaCompilerSpec extends UnitSpec with Diagrams {
}

def forkSameAsLocal() = IO.withTemporaryDirectory { out =>
val options = Seq("-deprecation") ++ {
if (scala.util.Properties.isJavaAtLeast("21")) {
Seq("-proc:none")
} else {
Nil
}
}

val (fresult, fproblems) =
compile(forked, Seq(knownSampleErrorFile), Seq("-deprecation"), out.toPath)
compile(forked, Seq(knownSampleErrorFile), options, out.toPath)
val (lresult, lproblems) =
compile(local, Seq(knownSampleErrorFile), Seq("-deprecation"), out.toPath)
compile(local, Seq(knownSampleErrorFile), options, out.toPath)
assert(fresult == lresult)

(fproblems zip lproblems) foreach {
Expand Down

0 comments on commit b6ce9ab

Please sign in to comment.