Description
consider the code
o = new Object() o[""]
Groovy 2.5.3 produces:
groovy.lang.MissingPropertyException: No such property: for class: java.lang.Object
Groovy 3.0.9 produces:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48) at java.base/java.lang.String.charAt(String.java:1512) at groovy.lang.MetaClassImpl.createMetaMethodAndMetaProperty(MetaClassImpl.java:2132) at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1887) at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3843) at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:199) at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:420) at org.codehaus.groovy.runtime.dgm$309.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:247) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
Expected behaviour is to have exception aligned with other missing properties like
> o = new Object() > o["x"] groovy.lang.MissingPropertyException: No such property: x for class: java.lang.Object at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:65) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:249) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139) at ideaGroovyConsole.run(ideaGroovyConsole.groovy:2) at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:254) at groovy.lang.GroovyShell.run(GroovyShell.java:360) at groovy.lang.GroovyShell.run(GroovyShell.java:339) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:170) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148) at console.run(console.groovy:11) at groovy.ui.GroovyMain.processReader(GroovyMain.java:631) at groovy.ui.GroovyMain.processFiles(GroovyMain.java:552) at groovy.ui.GroovyMain.run(GroovyMain.java:396) at groovy.ui.GroovyMain.access$1400(GroovyMain.java:68) at groovy.ui.GroovyMain$GroovyCommand.process(GroovyMain.java:322) at groovy.ui.GroovyMain.processArgs(GroovyMain.java:142) at groovy.ui.GroovyMain.main(GroovyMain.java:115) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:111) at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:129)