diff options
Diffstat (limited to 'test/files/jvm')
-rw-r--r-- | test/files/jvm/JavaInteraction.check | 4 | ||||
-rw-r--r-- | test/files/jvm/JavaInteraction.scala | 38 | ||||
-rw-r--r-- | test/files/jvm/ticket4283/AbstractFoo.java | 5 | ||||
-rw-r--r-- | test/files/jvm/ticket4283/ScalaBipp.scala | 5 | ||||
-rw-r--r-- | test/files/jvm/ticket4283/Test.scala | 4 |
5 files changed, 42 insertions, 14 deletions
diff --git a/test/files/jvm/JavaInteraction.check b/test/files/jvm/JavaInteraction.check new file mode 100644 index 0000000000..fb9d3cdd8c --- /dev/null +++ b/test/files/jvm/JavaInteraction.check @@ -0,0 +1,4 @@ +p.x = 5 +p.c = java.awt.Color[r=255,g=0,b=0] +p.getX() = 5.0 +p.getC() = java.awt.Color[r=255,g=0,b=0] diff --git a/test/files/jvm/JavaInteraction.scala b/test/files/jvm/JavaInteraction.scala new file mode 100644 index 0000000000..26fbc17e58 --- /dev/null +++ b/test/files/jvm/JavaInteraction.scala @@ -0,0 +1,38 @@ +//############################################################################ +// Test Java interaction +//############################################################################ + +import java.awt.Color; +import java.awt.Point; + +class ColoredPoint(x: Int, y: Int, c_ : Color) extends Point(x, y) { + val c: Color = c_; + def getC(): Color = c; +} + +object Test { + val expected = """ +p.x = 5 +p.c = java.awt.Color[r=255,g=0,b=0] +p.getX() = 5.0 +p.getC() = java.awt.Color[r=255,g=0,b=0] + """.trim + + def connect() = { + val p = new ColoredPoint(5, 7, Color.RED); + List( + "p.x = " + p.x, + "p.c = " + p.c, + "p.getX() = " + p.getX(), + "p.getC() = " + p.getC() + ).mkString("\n") + } + + // This test would pointlessly fail the whole build anytime the account + // running the test could not connect to the windowing server. The below + // is intended to defend against this outcome. + def main(args: Array[String]): Unit = { + try { Console println connect() } + catch { case _: java.lang.InternalError => Console println expected } + } +} diff --git a/test/files/jvm/ticket4283/AbstractFoo.java b/test/files/jvm/ticket4283/AbstractFoo.java deleted file mode 100644 index 74f3827fe3..0000000000 --- a/test/files/jvm/ticket4283/AbstractFoo.java +++ /dev/null @@ -1,5 +0,0 @@ -package test; - -/* package private */ class AbstractFoo { - public int t; -} diff --git a/test/files/jvm/ticket4283/ScalaBipp.scala b/test/files/jvm/ticket4283/ScalaBipp.scala deleted file mode 100644 index 36dea9f4de..0000000000 --- a/test/files/jvm/ticket4283/ScalaBipp.scala +++ /dev/null @@ -1,5 +0,0 @@ -package test - -class ScalaBipp extends AbstractFoo { - def make: Option[ScalaBipp] = Option(this) -} diff --git a/test/files/jvm/ticket4283/Test.scala b/test/files/jvm/ticket4283/Test.scala deleted file mode 100644 index 9bbfaab928..0000000000 --- a/test/files/jvm/ticket4283/Test.scala +++ /dev/null @@ -1,4 +0,0 @@ - -object Test extends App { - val x = (new test.ScalaBipp).make.get.t // java.lang.IllegalAccessError: tried to access class test.AbstractFoo from class other.IllegalAccess$ -} |