Permalink
Browse files

Another test for SI-2296.

  • Loading branch information...
paulp committed May 10, 2012
1 parent 0e197e8 commit b0dd0452fd14ad46c4be782f9227a0540782a2d7
@@ -0,0 +1 @@
RUNNING ACTION
@@ -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;
}
}
@@ -0,0 +1,9 @@
package bug;
public class Display {
protected Global m_glob;
public void start() {
m_glob.runActions();
}
}
@@ -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);
}
}
}
@@ -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
}
}
}
@@ -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()
}
@@ -0,0 +1,5 @@
object Test {
def main(args: Array[String]): Unit = {
test.Test main args
}
}

0 comments on commit b0dd045

Please sign in to comment.