Issue Details (XML | Word | Printable)

Key: GROOVY-2158
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jason Dillon
Reporter: Guillaume Laforge
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Code crashing in new shell but not in old

Created: 01/Oct/07 03:20 AM   Updated: 06/Oct/07 08:48 PM   Resolved: 06/Oct/07 08:48 PM
Return to search
Component/s: None
Affects Version/s: 1.1-beta-3
Fix Version/s: 1.1-rc-1

Time Tracking:
Not Specified

Environment: Windows XP, Java 6


 Description  « Hide

I've encountered a weird behavior. Some code crashes in the new shell, but not in the old one.

See the session below.
The same code in the new shell works very well.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Guillaume Laforge>set NEWSHELL=true

C:\Documents and Settings\Guillaume Laforge>groovysh
Groovy Shell (1.1-rc-1-SNAPSHOT, JVM: 1.6.0_02-b06)
Type 'help' or '\h' for help.
-------------------------------------------------------------------------------------------------------------
groovy0):000> time = { ===> null groovy:(0):001> it() ===> null groovy:(0):002> }
001> time = { 002> it() 003> }
ERROR groovy.lang.MissingMethodException: No signature of method: java.io.StringWriter.doCall() is applicable
for argument types: () values: {}
at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:558)
at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:529)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:771)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:598)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeClosure (ScriptBytecodeAdapter.java:612)
at groovysh_evaluate$_run_closure1.doCall (groovysh_evaluate:2)
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.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:57)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod (ClosureMetaClass.java:222)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:598)
at groovy.lang.Closure.call (Closure.java:292)
at groovy.lang.GString.writeTo (GString.java:155)
at groovy.lang.GString.toString (GString.java:133)
at org.codehaus.groovy.reflection.CachedClass.coerceGString (CachedClass.java:181)
at org.codehaus.groovy.reflection.ParameterTypes.coerceArgumentsToClasses (ParameterTypes.java:92)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:535)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:756)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:598)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Groovysh.setLastResult (Groovysh.groovy:92)
at org.codehaus.groovy.tools.shell.Groovysh.this$3$setLastResult (Groovysh.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.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:57)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.setProperty (MetaClassImpl.java:1726)
at groovy.lang.MetaClassImpl.setProperty (MetaClassImpl.java:2362)
at sun.reflect.GeneratedMethodAccessor11.invoke (Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:120)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:756)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:598)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Shell.setProperty (Shell.groovy)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectProperty (ScriptBytecodeAdapter.ja
va:571)
at org.codehaus.groovy.tools.shell.Groovysh.execute (Groovysh.groovy:182)
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.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:120)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:756)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:66)
at org.codehaus.groovy.tools.shell.Shell.leftShift (Shell.groovy:121)
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.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:120)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:756)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:598)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.ShellRunner.work (ShellRunner.groovy:88)
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.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:57)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:756)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:66)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0 (ScriptBytecodeAdapter.jav
a:99)
at org.codehaus.groovy.tools.shell.ShellRunner.run (ShellRunner.groovy:57)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run (InteractiveShellRunner.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.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:57)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:756)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN (ScriptBytecodeAdapter.java:
118)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0 (ScriptBytecodeAdapter.java:
142)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run (InteractiveShellRunner.groovy:64)
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.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:120)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:756)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:598)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0 (ScriptBytecodeAdapter.java:201)
at org.codehaus.groovy.tools.shell.Groovysh.run (Groovysh.groovy:446)
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.invokeByReflection (CachedMethod.java:100)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:120)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:756)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:598)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Groovysh.main (Groovysh.groovy:591)
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.tools.GroovyStarter.rootLoader (GroovyStarter.java:101)
at org.codehaus.groovy.tools.GroovyStarter.main (GroovyStarter.java:130)
groovy0):000>



Jason Dillon added a comment - 06/Oct/07 12:19 AM

What is this expected to return?

time = {
    it()
}

Guillaume Laforge added a comment - 06/Oct/07 03:03 AM

Initially, my example was a bit bigger, as it was a "timing" closure:

time = {
def start = System.currentTimeMillis()
it()
println System.currentTimeMillis() - start
}

This closure is handy, because you can use it to measure the time something takes like so:

time { /* do something that takes some time */ }

But I reduced this example to its simplest expression with time = { it() }
When everything is on the same line, it just works, but when it's spanning three lines, it fails with the huge stacktrace above.

So, it's not so much that I expect this to return something, but I just wanted to put that closure in the variable binding, so that I can reuse this timing closure to measure some things that took time to execute.


Guillaume Laforge added a comment - 06/Oct/07 05:24 AM

In my last comment, I mentioned time = { it() } worked when everything was on the same line, but it's false, whether it's on a single line or spanning several lines, it throws a huge stacktrace.


Jason Dillon added a comment - 06/Oct/07 05:59 AM

And this does work as expected in the old shell na?


Guillaume Laforge added a comment - 06/Oct/07 06:02 AM

Yup, you can check it by resetting your NEWSHELL env variable to void.
It does work with the old shell, but not with the new.


Jason Dillon added a comment - 06/Oct/07 06:24 AM

The problem is that the generated groovysh_evaluate$_run_closure1 does not have a reasonable toString() so when we log the result it pukes this up. Looking into solutions...


Jason Dillon added a comment - 06/Oct/07 06:39 AM

Should be fixed now


Guillaume Laforge added a comment - 06/Oct/07 06:59 AM

I still get the issue after updating:

C:\oss\groovy-core>groovysh
Groovy Shell (1.1-rc-1-SNAPSHOT, JVM: 1.6.0_02-b06)
Type 'help' or '\h' for help.
-------------------------------------------------------------------------------------------------------------
groovy:000> time = { ===> null groovy:001> it() ===> null groovy:002> }

001> time = { 002> it() 003> }

ERROR groovy.lang.MissingMethodException: No signature of method: java.io.StringWriter.doCall() is applicable
for argument types: () values: {}
at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:562)
at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:538)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:775)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:602)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeClosure (ScriptBytecodeAdapter.java:612)
at groovysh_evaluate$_run_closure1.doCall (groovysh_evaluate:2)
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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:58)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod (ClosureMetaClass.java:219)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:602)
at groovy.lang.Closure.call (Closure.java:293)
at groovy.lang.GString.writeTo (GString.java:155)
at groovy.lang.GString.toString (GString.java:133)
at org.codehaus.groovy.reflection.CachedClass.coerceGString (CachedClass.java:183)
at org.codehaus.groovy.reflection.ParameterTypes.coerceArgumentsToClasses (ParameterTypes.java:107)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:535)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:602)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Groovysh.setLastResult (Groovysh.groovy:93)
at org.codehaus.groovy.tools.shell.Groovysh.this$3$setLastResult (Groovysh.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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:58)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.setProperty (MetaClassImpl.java:1763)
at groovy.lang.MetaClassImpl.setProperty (MetaClassImpl.java:2428)
at sun.reflect.GeneratedMethodAccessor11.invoke (Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:127)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:602)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Shell.setProperty (Shell.groovy)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectProperty (ScriptBytecodeAdapter.ja
va:571)
at org.codehaus.groovy.tools.shell.Groovysh.execute (Groovysh.groovy:183)
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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:127)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:66)
at org.codehaus.groovy.tools.shell.Shell.leftShift (Shell.groovy:121)
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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:127)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:602)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.ShellRunner.work (ShellRunner.groovy:88)
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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:58)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:66)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0 (ScriptBytecodeAdapter.jav
a:99)
at org.codehaus.groovy.tools.shell.ShellRunner.run (ShellRunner.groovy:57)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run (InteractiveShellRunner.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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:58)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN (ScriptBytecodeAdapter.java:
118)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0 (ScriptBytecodeAdapter.java:
142)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run (InteractiveShellRunner.groovy:64)
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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:127)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:602)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0 (ScriptBytecodeAdapter.java:201)
at org.codehaus.groovy.tools.shell.Groovysh.run (Groovysh.groovy:461)
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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:127)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:66)
at org.codehaus.groovy.tools.shell.Groovysh.run (Groovysh.groovy:402)
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.invokeByReflection (CachedMethod.java:107)
at org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:127)
at org.codehaus.groovy.runtime.metaclass.StdMetaMethod.invoke (StdMetaMethod.java:18)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:760)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:602)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Groovysh.main (Groovysh.groovy:561)
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.tools.GroovyStarter.rootLoader (GroovyStarter.java:101)
at org.codehaus.groovy.tools.GroovyStarter.main (GroovyStarter.java:130)
groovy:000>


Jason Dillon added a comment - 06/Oct/07 07:57 PM

Looks like there are a few more places where a gstring is used to output the result, which causes this to barf. I'm digging thme up... and using String.valueOf() instead which resolves this problem.


Jason Dillon added a comment - 06/Oct/07 08:48 PM

I've found a few other places where this might pop up... but you an still make this happen with:

time = { it() }
println "$time"

Though this works fine:

time = { it() }
println time

My guess is there is another deeper bug in here... but ATM I'm not sure what the fix is.