Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-beta-5
-
None
-
None
-
Version: 1.0-beta-6-SNAPSHOT JVM: 1.4.1_01-27; Mac OS X Panther
Description
This code still fails, as reported in issue GROOVY-451. This is tested with snapshot dated 14 May. Replacing any of the commented out code with its neighbor removes the crash. Crash report follows code.
#!/usr/bin/env groovy
import java.awt.Color
import java.util.ArrayList
public class Test {
ArrayList agents
int numAgents = 4
int spaceSize = 50
// spaceSize = 50 // removing int avoids crash
public void setup()
{ Random.createUniform() agents = new ArrayList() } public void begin() {
// for (i in 1..numAgents) { // using for avoids crash
this.numAgents.times
println agents.size()
}
}
public class Random {
static Random uniform
static void createUniform()
int nextIntFromTo (int from, int to)
{(from + to / 2).intValue()}}
public class TinyAgent {
int x; int y; Color color
public void move(int nextX, int nextY)
}
Test t = new Test()
t.setup(); t.begin()
owen|~/src/groovy/tiny[784]
: ./test.groovy
Exception in thread "main" java.lang.VerifyError: (class: Test$_begin_closure1, method: doCall signature: (Ljava/lang/Object;)Ljava/lang/Object Expecting to find object/array on stack
at Test.begin(test.groovy:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.codehaus.groovy.runtime.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:63)
at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1020)
at groovy.lang.MetaClass.invokeMethod(MetaClass.java:314)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)