[
https://issues.apache.org/jira/browse/GROOVY-11959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King updated GROOVY-11959:
-------------------------------
Description:
This example involving a primitive (and expected to fail since it's not an
aggregate):
{code:groovy}
int z = 42
def (x, y) = z
{code}
Gives:
{noformat}
java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
ConsoleScript20.run()Ljava/lang/Object; @31: aload_1
Reason:
Type integer (current frame, locals[1]) is not assignable to reference type
Current Frame:
bci: @31
flags: { }
locals: { 'ConsoleScript20', integer, 'java/lang/Object' }
stack: { 'java/lang/Object', 'java/lang/Object' }
Bytecode:
0000000: 102a 3c1b ba00 2f00 004d 2cba 0034 0000
0000010: ba00 3a00 0099 002d 2cba 003d 0000 592b
0000020: a500 214e 2cba 0034 0000 ba00 3a00 0099
0000030: 000c 2cba 003d 0000 a700 0401 3a04 a700
0000040: 1557 1b03 ba00 4200 004e 1b04 ba00 4200
0000050: 003a 041b b800 48b0
Stackmap Table:
append_frame(@59,Integer,Object[#77],Object[#77])
same_locals_1_stack_item_frame(@60,Object[#77])
full_frame(@65,{Object[#2],Integer,Object[#77]},{Object[#77]})
same_frame(@66)
append_frame(@83,Object[#77],Object[#77])
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3375)
at java.base/java.lang.Class.getConstructor0(Class.java:3580)
at java.base/java.lang.Class.getConstructor(Class.java:2273)
at
org.codehaus.groovy.runtime.InvokerHelper.newScript(InvokerHelper.java:498)
{noformat}
This:
{code:groovy}
Integer z = 42
def (x, y) = z
{code}
Gives this as expected:
{noformat}
groovy.lang.MissingMethodException: No signature of method: getAt for class:
java.lang.Integer is applicable for argument types: (Integer) values: [0]
{noformat}
was:
{code:groovy}
def (x, y) = 42
{code}
Gives:
{noformat}
Exception thrown
java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
ConsoleScript20.run()Ljava/lang/Object; @31: aload_1
Reason:
Type integer (current frame, locals[1]) is not assignable to reference type
Current Frame:
bci: @31
flags: { }
locals: { 'ConsoleScript20', integer, 'java/lang/Object' }
stack: { 'java/lang/Object', 'java/lang/Object' }
Bytecode:
0000000: 102a 3c1b ba00 2f00 004d 2cba 0034 0000
0000010: ba00 3a00 0099 002d 2cba 003d 0000 592b
0000020: a500 214e 2cba 0034 0000 ba00 3a00 0099
0000030: 000c 2cba 003d 0000 a700 0401 3a04 a700
0000040: 1557 1b03 ba00 4200 004e 1b04 ba00 4200
0000050: 003a 041b b800 48b0
Stackmap Table:
append_frame(@59,Integer,Object[#77],Object[#77])
same_locals_1_stack_item_frame(@60,Object[#77])
full_frame(@65,{Object[#2],Integer,Object[#77]},{Object[#77]})
same_frame(@66)
append_frame(@83,Object[#77],Object[#77])
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at
java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3375)
at java.base/java.lang.Class.getConstructor0(Class.java:3580)
at java.base/java.lang.Class.getConstructor(Class.java:2273)
at
org.codehaus.groovy.runtime.InvokerHelper.newScript(InvokerHelper.java:498)
{noformat}
> multi-assignment edge case not handled
> --------------------------------------
>
> Key: GROOVY-11959
> URL: https://issues.apache.org/jira/browse/GROOVY-11959
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Priority: Major
>
> This example involving a primitive (and expected to fail since it's not an
> aggregate):
> {code:groovy}
> int z = 42
> def (x, y) = z
> {code}
> Gives:
> {noformat}
> java.lang.VerifyError: Bad local variable type
> Exception Details:
> Location:
> ConsoleScript20.run()Ljava/lang/Object; @31: aload_1
> Reason:
> Type integer (current frame, locals[1]) is not assignable to reference
> type
> Current Frame:
> bci: @31
> flags: { }
> locals: { 'ConsoleScript20', integer, 'java/lang/Object' }
> stack: { 'java/lang/Object', 'java/lang/Object' }
> Bytecode:
> 0000000: 102a 3c1b ba00 2f00 004d 2cba 0034 0000
> 0000010: ba00 3a00 0099 002d 2cba 003d 0000 592b
> 0000020: a500 214e 2cba 0034 0000 ba00 3a00 0099
> 0000030: 000c 2cba 003d 0000 a700 0401 3a04 a700
> 0000040: 1557 1b03 ba00 4200 004e 1b04 ba00 4200
> 0000050: 003a 041b b800 48b0
> Stackmap Table:
> append_frame(@59,Integer,Object[#77],Object[#77])
> same_locals_1_stack_item_frame(@60,Object[#77])
> full_frame(@65,{Object[#2],Integer,Object[#77]},{Object[#77]})
> same_frame(@66)
> append_frame(@83,Object[#77],Object[#77])
> at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
> at
> java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3375)
> at java.base/java.lang.Class.getConstructor0(Class.java:3580)
> at java.base/java.lang.Class.getConstructor(Class.java:2273)
> at
> org.codehaus.groovy.runtime.InvokerHelper.newScript(InvokerHelper.java:498)
> {noformat}
> This:
> {code:groovy}
> Integer z = 42
> def (x, y) = z
> {code}
> Gives this as expected:
> {noformat}
> groovy.lang.MissingMethodException: No signature of method: getAt for class:
> java.lang.Integer is applicable for argument types: (Integer) values: [0]
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)