diff options
Diffstat (limited to 'test/files/jvm/nest')
-rw-r--r-- | test/files/jvm/nest/nest.java | 38 | ||||
-rw-r--r-- | test/files/jvm/nest/nest.scala | 21 |
2 files changed, 59 insertions, 0 deletions
diff --git a/test/files/jvm/nest/nest.java b/test/files/jvm/nest/nest.java new file mode 100644 index 0000000000..3f6f0bebbd --- /dev/null +++ b/test/files/jvm/nest/nest.java @@ -0,0 +1,38 @@ +package nestpkg; + + +/** This file is needed for test 'nest.scala'. It should + * be compiled with javac and packaged into lib/nest.jar + */ +public class nest { + public static class best { + public static class rest { + public static rest test = new rest(); + public static int x = 10; + public int inc(int i) { + return i + 1; + } + } + } + + + String name = "Outer name"; + + public class Inn { + int x; + + public Inn(int x) { + this.x = x; + } + + public void doSomething() { + System.out.println("Inn " + name + " x: " + x); + } + } + + protected class ProtInn { + public void doSomething() { + System.out.println("ProtInn " + name); + } + } +} diff --git a/test/files/jvm/nest/nest.scala b/test/files/jvm/nest/nest.scala new file mode 100644 index 0000000000..3ab62484fa --- /dev/null +++ b/test/files/jvm/nest/nest.scala @@ -0,0 +1,21 @@ +//############################################################################ +// Test Scala interaction with Java nested classes and static members. +//############################################################################ + +/** found in nest.jar, compiled from nest.java */ +import nestpkg._; + +object Test extends Application { + val x = nest.best.rest.test + Console.println(x.inc(1)) + + val o = new nest.best; + val r = new nest.best.rest; + Console.println(nest.best.rest.test.inc(2)) + Console.println(nest.best.rest.x) + + print("Instantiating public inner class: ") + val outer = new nest + val inn = new outer.Inn(42) + inn.doSomething +} |