@@ -26,6 +26,8 @@ class CompilationTests {
26
26
import CompilationTests ._
27
27
import CompilationTest .aggregateTests
28
28
29
+ def `isJava16+` : Boolean = scala.util.Properties .isJavaAtLeast(" 16" )
30
+
29
31
// Positive tests ------------------------------------------------------------
30
32
31
33
@ Test def pos : Unit = {
@@ -50,7 +52,7 @@ class CompilationTests {
50
52
else Nil
51
53
)
52
54
53
- if scala.util. Properties .isJavaAtLeast( " 16 " ) then
55
+ if `isJava16+` then
54
56
tests ::= compileFilesInDir(" tests/pos-java16+" , defaultOptions.and(" -Ysafe-init" ))
55
57
56
58
aggregateTests(tests* ).checkCompile()
@@ -155,13 +157,18 @@ class CompilationTests {
155
157
156
158
@ Test def runAll : Unit = {
157
159
implicit val testGroup : TestGroup = TestGroup (" runAll" )
158
- aggregateTests (
160
+ var tests = List (
159
161
compileFilesInDir(" tests/run" , defaultOptions.and(" -Ysafe-init" )),
160
162
compileFilesInDir(" tests/run-deep-subtype" , allowDeepSubtypes),
161
163
compileFilesInDir(" tests/run-custom-args/captures" , allowDeepSubtypes.and(" -language:experimental.captureChecking" )),
162
164
// Run tests for legacy lazy vals.
163
165
compileFilesInDir(" tests/run" , defaultOptions.and(" -Ysafe-init" , " -Ylegacy-lazy-vals" , " -Ycheck-constraint-deps" ), FileFilter .include(TestSources .runLazyValsAllowlist)),
164
- ).checkRuns()
166
+ )
167
+
168
+ if `isJava16+` then
169
+ tests ::= compileFilesInDir(" tests/run-java16+" , defaultOptions.and(" -Ysafe-init" ))
170
+
171
+ aggregateTests(tests* ).checkRuns()
165
172
}
166
173
167
174
// Generic java signatures tests ---------------------------------------------
0 commit comments