From 2d26b75dc6bfc38b7f8735157fc8109f55afe010 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 9 Jun 2022 11:35:53 -0700 Subject: [PATCH] Partest uses -release 8 --- src/partest/scala/tools/partest/nest/Runner.scala | 8 +++++--- test/files/neg/nonunit-statement.scala | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/partest/scala/tools/partest/nest/Runner.scala b/src/partest/scala/tools/partest/nest/Runner.scala index 990ed6be347a..d5c63ed442ea 100644 --- a/src/partest/scala/tools/partest/nest/Runner.scala +++ b/src/partest/scala/tools/partest/nest/Runner.scala @@ -453,10 +453,12 @@ class Runner(val testInfo: TestInfo, val suiteRunner: AbstractRunner) { } // all sources in a round may contribute flags via // scalac: -flags + // if a javaVersion isn't specified, require the minimum viable using -release 8 to avoid gotcha in CI. def flagsForCompilation(sources: List[File]): List[String] = { - val perFile = toolArgsFor(sources)("scalac") - if (parentFile.getParentFile.getName == "macro-annot") "-Ymacro-annotations" :: perFile - else perFile + var perFile = toolArgsFor(sources)("scalac") + if (parentFile.getParentFile.getName == "macro-annot") perFile ::= "-Ymacro-annotations" + if (toolArgsFor(sources)("javaVersion", split = false).isEmpty) perFile :::= List("-release", "8") + perFile } // inspect sources for tool args diff --git a/test/files/neg/nonunit-statement.scala b/test/files/neg/nonunit-statement.scala index 9fa91069305f..1b53fc12b4c0 100644 --- a/test/files/neg/nonunit-statement.scala +++ b/test/files/neg/nonunit-statement.scala @@ -156,6 +156,7 @@ class J { import java.util.Collections def xs: java.util.List[Int] = ??? def f(): Int = { + java.util.List.of[Int]() Collections.checkedList[Int](xs, classOf[Int]) 42 }