summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-09 21:56:13 -0700
committerPaul Phillips <paulp@improving.org>2012-05-09 21:58:39 -0700
commitb0dd0452fd14ad46c4be782f9227a0540782a2d7 (patch)
treea7b874381f2103436ba84ced8749fd3d8e65db30
parent0e197e89ac96ec0dd8b136de8e07ad2e15f94371 (diff)
downloadscala-b0dd0452fd14ad46c4be782f9227a0540782a2d7.tar.gz
scala-b0dd0452fd14ad46c4be782f9227a0540782a2d7.tar.bz2
scala-b0dd0452fd14ad46c4be782f9227a0540782a2d7.zip
Another test for SI-2296.
-rw-r--r--test/files/run/t2296c.check1
-rw-r--r--test/files/run/t2296c/Action.java21
-rw-r--r--test/files/run/t2296c/Display.java9
-rw-r--r--test/files/run/t2296c/Global.java29
-rw-r--r--test/files/run/t2296c/ScalaActivity.scala18
-rw-r--r--test/files/run/t2296c/Test.scala15
-rw-r--r--test/files/run/t2296c/a.scala5
7 files changed, 98 insertions, 0 deletions
diff --git a/test/files/run/t2296c.check b/test/files/run/t2296c.check
new file mode 100644
index 0000000000..076e9180a8
--- /dev/null
+++ b/test/files/run/t2296c.check
@@ -0,0 +1 @@
+RUNNING ACTION
diff --git a/test/files/run/t2296c/Action.java b/test/files/run/t2296c/Action.java
new file mode 100644
index 0000000000..50ba9a4de1
--- /dev/null
+++ b/test/files/run/t2296c/Action.java
@@ -0,0 +1,21 @@
+package bug.action;
+
+import bug.Global;
+
+public abstract class Action {
+ protected Global m_glob;
+
+ public Action(Global glob0) {
+ m_glob = glob0;
+ }
+
+ public Action() {
+ this(null);
+ }
+
+ public abstract void run(int v);
+
+ public void setGlobal(Global g) {
+ m_glob = g;
+ }
+}
diff --git a/test/files/run/t2296c/Display.java b/test/files/run/t2296c/Display.java
new file mode 100644
index 0000000000..7f7e6a73d0
--- /dev/null
+++ b/test/files/run/t2296c/Display.java
@@ -0,0 +1,9 @@
+package bug;
+
+public class Display {
+ protected Global m_glob;
+
+ public void start() {
+ m_glob.runActions();
+ }
+}
diff --git a/test/files/run/t2296c/Global.java b/test/files/run/t2296c/Global.java
new file mode 100644
index 0000000000..7e5a762de2
--- /dev/null
+++ b/test/files/run/t2296c/Global.java
@@ -0,0 +1,29 @@
+package bug;
+
+import bug.action.Action;
+import java.util.List;
+import java.util.LinkedList;
+
+public class Global {
+ public int items() {
+ return 0;
+ }
+
+ public int items(int i) {
+ return i + ls.size();
+ }
+
+ private List<Action> ls = new LinkedList<Action>();
+
+ public void putAction(Action a) {
+ a.setGlobal(this);
+ ls.add(a);
+ }
+
+ public void runActions() {
+ for (Action action: ls) {
+ System.out.println("RUNNING ACTION");
+ action.run(0);
+ }
+ }
+}
diff --git a/test/files/run/t2296c/ScalaActivity.scala b/test/files/run/t2296c/ScalaActivity.scala
new file mode 100644
index 0000000000..aa7648a944
--- /dev/null
+++ b/test/files/run/t2296c/ScalaActivity.scala
@@ -0,0 +1,18 @@
+package test
+
+import bug.Display
+import bug.action.Action
+
+abstract class Outer extends Display {
+
+ def init() {
+ m_glob.putAction(ScalaActivity)
+ }
+
+ object ScalaActivity extends Action {
+ def run(v: Int) {
+ val testSet = List(1,2,3)
+ testSet.map(p => m_glob.items(p)) // crash with illegal access
+ }
+ }
+}
diff --git a/test/files/run/t2296c/Test.scala b/test/files/run/t2296c/Test.scala
new file mode 100644
index 0000000000..1132bebebb
--- /dev/null
+++ b/test/files/run/t2296c/Test.scala
@@ -0,0 +1,15 @@
+package test
+
+import bug.Global
+
+object Test {
+ def main(args: Array[String]) {
+ val m = new Main()
+ m.init()
+ m.start()
+ }
+}
+
+class Main extends Outer {
+ m_glob = new Global()
+}
diff --git a/test/files/run/t2296c/a.scala b/test/files/run/t2296c/a.scala
new file mode 100644
index 0000000000..fae32f4ec4
--- /dev/null
+++ b/test/files/run/t2296c/a.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ test.Test main args
+ }
+}