summaryrefslogtreecommitdiff
path: root/test/files/jvm/nest
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-04-05 06:24:22 +0000
committerPaul Phillips <paulp@improving.org>2010-04-05 06:24:22 +0000
commite8a121e9e1ade3f283f42fceb3c18f30a8468f57 (patch)
treefc58111a69bb8940f7c5bd341fa3a8f097955403 /test/files/jvm/nest
parent28ed5c6b216463a6e5bd8f06986c35a2036bda3f (diff)
downloadscala-e8a121e9e1ade3f283f42fceb3c18f30a8468f57.tar.gz
scala-e8a121e9e1ade3f283f42fceb3c18f30a8468f57.tar.bz2
scala-e8a121e9e1ade3f283f42fceb3c18f30a8468f57.zip
If I work on this patch any longer without chec...
If I work on this patch any longer without checking in I will go stark raving mad. It is broken up into a couple pieces. This one is the changes to test/. It includes fixing a bunch of tests, removing deprecated constructs, moving jars used by tests to the most specific plausible location rather than having all jars on the classpath of all tests, and some filesystem layout change (continuations get their whole own srcpath.) This would be the world's most tedious review, so let's say no review. [Note: after this commit, I doubt things will build very smoothly until the rest of the partest changes follow. Which should only be seconds, but just in case.]
Diffstat (limited to 'test/files/jvm/nest')
-rw-r--r--test/files/jvm/nest/nest.java38
-rw-r--r--test/files/jvm/nest/nest.scala21
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
+}