Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.0-JSR-6
-
Fix Version/s: 1.0-JSR-6
-
Component/s: None
-
Labels:None
-
Environment:Tried with JRE 1.5.0_06 and 1.6.0-beta2-b81, WinXPSP2 and tested against CVS HEAD (as built by "maven"), Groovy reports itself as 1.0-RC-01-SNAPSHOT
-
Number of attachments :
Description
1. cvs checkout
2. maven
3. wait
4. .\target\install\bin\groovyConsole.bat
5. observe the stack trace below trace
6. zip -d groovy-1.0-RC-01-SNAPSHOT.jar groovy/ui/Console.groovy
deleting: groovy/ui/Console.groovy
7. .\target\install\bin\groovyConsole.bat
8. observe that it starts now
java.lang.reflect.InvocationTargetException
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:589)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:131)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:160)
Caused by: java.lang.ClassCastException: groovy.ui.Console cannot be cast to groovy.ui.Console
at gjdk.groovy.ui.Console_GroovyReflector.invoke(Unknown Source)
at groovy.lang.MetaMethod.invoke(MetaMethod.java:111)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:657)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:350)
at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:156)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNoArgumentsMethod(ScriptBytecodeAdapter.java:175)
at groovy.ui.Console.main(Console.groovy:76)
... 6 more
Sorry to follow up my own bug, but I downloaded groovy-1.0-jsr-05 to ensure it wasn't something in my environment that was corrupt.
As it turns out, a jar from a reporting vendor contains antlr.* classes, which really jams up groovy. With the offending jar in the classpath, any statement (in groovysh or groovyconsole) will produce this lovely:
The actual problem may have been caused by groovy trying to reparse groovy/ui/Console.groovy on startup, which was failing because of the above error (obviously swallowed, since I didn't see it). When I nuked groovy/ui/Console.groovy, it fell back to the compiled version and started but any expression typed would cause the above error.
I believe the fix is to load the groovy classes into a "parent" classloader and load any specified classpath (command line or environment) in a dependent classloader.
Sorry for the rash post.