Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-JSR-2
-
None
-
None
-
None
Description
// This works fine.
int[] n1 = [1, 2, 3]
int[] n2 = [100, 200]
def n = [n1, n2]
n.each
// But, this geneates an NPE.
Object[] n1 = [1, 2, 3]
Object[] n2 = [100, 200]
def n = [n1, n2]
n.each { println( it ) }
Caught: java.lang.NullPointerException
java.lang.NullPointerException
at groovy.ui.GroovyMain.run(GroovyMain.java:267)
at groovy.ui.GroovyMain.process(GroovyMain.java:235)
at groovy.ui.GroovyMain.main(GroovyMain.java:138)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:92)
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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:429)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Attachments
Issue Links
- duplicates
-
GROOVY-886 each(){} throws NPE when called on a Java Object[], that contains String[]'s with null entries
- Closed
- is depended upon by
-
GROOVY-764 closures
- Closed