added a comment - - edited
Hi, I have this problem using eclipse 3.7 Indigo (Build id: 20110615-0604), with a fresh installed groovy plugin. I run Ubuntu 11.04, Oracle JDK 1.6.0_25. Groovy Compiler 1.8.0.xx.20110628-1600-e37, the groovy pluginversions are added as screenshot (I was lazy).
I added a sample code fragment, that breaks when launching in eclipse (script and console), but does not when using the command line via groovy sandbox/Greeter.groovy.
package sandbox
class Greeter {
static void main(String[] args) {
def mygreeting = "Hello World"
println mygreeting
}
}
I attached a project with launcher configuration, to provide best possible reproducibility.
Here is the complete stacktrace when run in console:
groovy> package sandbox
groovy> class Greeter {
groovy> static void main(String[] args) {
groovy> def mygreeting = "Hello World"
groovy> println mygreeting
groovy> }
groovy> }
Exception thrown
17.08.2011 13:08:16 org.codehaus.groovy.runtime.StackTraceUtils sanitize
WARNUNG: Sanitizing stacktrace:
java.lang.AbstractMethodError
at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:266)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:366)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:174)
at org.codehaus.groovy.control.CompilationUnit$13.call(CompilationUnit.java:763)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:957)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:542)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:520)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731)
at groovy.lang.GroovyShell.run(GroovyShell.java:516)
at groovy.lang.GroovyShell.run(GroovyShell.java:172)
at groovy.lang.GroovyShell$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy:910)
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:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:885)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy)
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:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:885)
at groovy.lang.Closure.call(Closure.java:405)
at groovy.lang.Closure.call(Closure.java:399)
at groovy.lang.Closure.run(Closure.java:483)
at java.lang.Thread.run(Thread.java:662)
java.lang.AbstractMethodError
How exactly are you running this? What are you selecting when you do the Run As?
I selected the script file, right-click -> Run As -> Groovy Script. And I had no problems.