You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/19 15:16:00 UTC

[jira] [Updated] (GROOVY-6610) "Expecting to find object/array on stack" VerifyError when passing static member as argument to chained ctor call

     [ https://issues.apache.org/jira/browse/GROOVY-6610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-6610:
--------------------------------
    Fix Version/s: 3.0.8

> "Expecting to find object/array on stack" VerifyError when passing static member as argument to chained ctor call
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-6610
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6610
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.2.2, 2.4.0-rc-1
>         Environment: GNU/Linux (x64 SUSE and x86 Fedora Core 18)
>            Reporter: David Costanzo
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 3.0.8, 4.0.0-alpha-3
>
>         Attachments: ReproBug.groovy
>
>
> The attached script causes the following syntax error when run with Groovy 2.2.2.
> {quote}
> Caught: java.lang.VerifyError: (class: ReproBug$MyClass, method: <init> signature: ()V) Expecting to find object/array on stack
> java.lang.VerifyError: (class: ReproBug$MyClass, method: <init> signature: ()V) Expecting to find object/array on stack
> 	at ReproBug.main(ReproBug.groovy:18)
> {quote}
> The code compiles and runs fine as a Java class, which is why I think this is a bug in Groovy.
> The problem requires the conjunction of two things:
> 1) A constructor that invokes another constructor
> 2) Converting an integer to a string as a parameter to the constructor
> I encountered this during real-world scripting (although I used a integer literal), but was able to figure out the cause and work-around the problem.  As such, this does not personally impact me; I am reporting it because I like Groovy and this is an easy way to contribute.
> Since I don't know whether you prefer an attachment or an inline quote, here is the code.
> {code}
> public class ReproBug {
>     static private Integer MYINT = 4;
>     
>     private static class MyClass {
>         public final String value;
>         public MyClass(String string) {
>             value = string;
>         }
>         public MyClass() {
>             this(MYINT.toString()); // <--- causes problems
>         }
>     }
>     public static void main(String[] args) {
>         System.out.println(new MyClass().value);
>     }
> }
> {code}
> I haven't figured out how to create a Groovy unit test case.  If someone can point me to an example where simply getting the script to compile is proof that the bug is fixed, I'll try to work the attached code into a Groovy unit test case.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)