Skip to content

Commit 1165362

Browse files
committed
bugfix: Fix tests not working on JDK 8
And enable JDK 8 tests on PRs
1 parent 1224e32 commit 1165362

9 files changed

Lines changed: 23 additions & 23 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ jobs:
506506
|| (
507507
github.event_name == 'pull_request'
508508
&& !contains(github.event.pull_request.body, '[skip ci]')
509-
&& contains(github.event.pull_request.body, '[test_java8]')
510509
)
511510
|| (
512511
github.event_name == 'workflow_dispatch'

compiler/test/dotty/tools/dotc/classpath/MultiReleaseJarTest.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ import org.junit.Test
1515
import scala.jdk.CollectionConverters._
1616
import scala.util.Properties
1717

18+
import org.junit.Assume.assumeTrue
19+
1820
class MultiReleaseJarTest extends dotty.tools.backend.jvm.DottyBytecodeTest {
1921

2022
@Test
2123
def mrJar(): Unit = {
24+
assumeTrue("Multi-release JARs require JDK 9+", Properties.isJavaAtLeast("9"))
2225

2326
// The test fails if the same jar file gets reused. This might be a caching problem in our classpath implementation
2427

@@ -70,6 +73,7 @@ class MultiReleaseJarTest extends dotty.tools.backend.jvm.DottyBytecodeTest {
7073

7174
@Test
7275
def ctSymTest(): Unit = {
76+
assumeTrue("ct.sym cross-compilation requires JDK 9+", Properties.isJavaAtLeast("9"))
7377

7478
def classExists(className: String, release: String): Boolean = {
7579
given ctx: Context = initCtx.fresh

compiler/test/dotty/tools/io/ZipArchiveTest.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,11 @@ class ZipArchiveTest {
4444
}
4545
}
4646

47-
private val bootClassLoader: ClassLoader = {
48-
ClassLoader.getPlatformClassLoader
49-
}
50-
5147
private def classLoader(location: URI): ClassLoader =
52-
new URLClassLoader(Array(location.toURL), bootClassLoader)
48+
new URLClassLoader(Array(location.toURL), /*parent*/ null)
5349

54-
private def manifestAt(location: URI): URL = classLoader(location).getResource("META-INF/MANIFEST.MF")
50+
private def manifestAt(location: URI): URL =
51+
classLoader(location).getResource("META-INF/MANIFEST.MF")
5552

5653

5754
// ZipArchive.fromManifestURL(URL)

tests/neg/i24711-java-nested-types.check

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
| Required: Int
66
|
77
| longer explanation available when compiling with `-explain`
8-
-- [E007] Type Mismatch Error: tests/neg/i24711-java-nested-types.scala:4:38 -------------------------------------------
9-
4 | val test2: Int = java.util.Map.entry("key", 1) // error
10-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11-
| Found: java.util.Map.Entry[String, Int]
12-
| Required: Int
8+
-- [E007] Type Mismatch Error: tests/neg/i24711-java-nested-types.scala:4:20 -------------------------------------------
9+
4 | val test2: Int = (??? : java.util.Map.Entry[String, Int]) // error
10+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11+
| Found: java.util.Map.Entry[String, Int]
12+
| Required: Int
1313
|
1414
| longer explanation available when compiling with `-explain`
1515
-- [E007] Type Mismatch Error: tests/neg/i24711-java-nested-types.scala:7:20 -------------------------------------------

tests/neg/i24711-java-nested-types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Test {
22
val test1: Int = (??? : java.util.Map.Entry[String, Int]) // error
33

4-
val test2: Int = java.util.Map.entry("key", 1) // error
4+
val test2: Int = (??? : java.util.Map.Entry[String, Int]) // error
55

66
trait Outer { type Inner }
77
val test4: Int = (??? : Outer#Inner) // error

tests/pos/i24894b/Foo_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@Deprecated(since = Bar.bar()) class Foo
1+
@SuppressWarnings(Array(Bar.bar())) class Foo

tests/run/i23245a/api.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ package logadapter:
77
trait AbstractApi[T <: AbstractLogAdapter]:
88
def logAdapterFor(loggerName: String): T
99
trait SelfLogging:
10-
given adapter: T = logAdapterFor(this.getClass.getName)
10+
given adapter: T = logAdapterFor("TestLogger")
1111
// workaround:
12-
//given () => T = logAdapterFor(this.getClass.getName)
12+
//given () => T = logAdapterFor("TestLogger")
1313
// or
14-
//private val adapter = logAdapterFor(this.getClass.getName)
14+
//private val adapter = logAdapterFor("TestLogger")
1515
//given T = adapter
1616
// or just pollute the interface so it's never taken as pure
1717
//private val z = 42

tests/run/i24553.check

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
public boolean java.lang.Object.equals(java.lang.Object)
22
public final native java.lang.Class<?> java.lang.Object.getClass()
3-
public native int java.lang.Object.hashCode()
4-
public int Foo.hello()
53
public final native void java.lang.Object.notify()
64
public final native void java.lang.Object.notifyAll()
7-
public java.lang.String java.lang.Object.toString()
8-
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
9-
public final void java.lang.Object.wait() throws java.lang.InterruptedException
105
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
6+
public final void java.lang.Object.wait() throws java.lang.InterruptedException
7+
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
8+
public int Foo.hello()
119
public int Foo.x()
10+
public java.lang.String java.lang.Object.toString()
11+
public native int java.lang.Object.hashCode()

tests/run/i24553.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ class Foo:
44
val x: hello.type = ???
55

66
@main def Test =
7-
val mtds = classOf[Foo].getMethods().sortBy(_.getName())
7+
val mtds = classOf[Foo].getMethods().sortBy(_.toGenericString())
88
for mtd <- mtds do println(mtd.toGenericString())

0 commit comments

Comments
 (0)