Richard Warburton | 16 Jun 2012 20:09
Picon
Gravatar

[groovy-dev] Potential Method Overloading bug in Groovy 2

Hey all,

I'm sorry if I'm doing the wrong thing by reporting the bug on this
list rather than the bug tracker, but I only saw a milestone for rc-4,
and this seems to be a bug on rc-3, which is the latest version linked
from the website.  I think I've identified a bug in the static
compilation backend.  If run the following program, I get a failure
during verification:

import static org.junit.Assert.*;
import groovy.transform.CompileStatic;

 <at> CompileStatic
class CompilerBugs {

  public static void main(String[] args) {
    int expected = 0
    assertEquals(expected, args.length)
  }

}

If I remove the  <at> CompileStatic then the program executes fine.  The
specific error message is : "(class: CompilerBugs, method: main
signature: ([Ljava/lang/String;)V) Expecting to find object/array on
stack".  The bytecode that gets produced for the main method is:

public static void main(java.lang.String[]);
  Code:
   0:   iconst_0
(Continue reading)

Rémi Forax | 16 Jun 2012 20:57
Picon

Re: [groovy-dev] Potential Method Overloading bug in Groovy 2

On 06/16/2012 08:09 PM, Richard Warburton wrote:
> Hey all,
>
> I'm sorry if I'm doing the wrong thing by reporting the bug on this
> list rather than the bug tracker, but I only saw a milestone for rc-4,
> and this seems to be a bug on rc-3, which is the latest version linked
> from the website.  I think I've identified a bug in the static
> compilation backend.  If run the following program, I get a failure
> during verification:
>
> import static org.junit.Assert.*;
> import groovy.transform.CompileStatic;
>
>  <at> CompileStatic
> class CompilerBugs {
>
>    public static void main(String[] args) {
>      int expected = 0
>      assertEquals(expected, args.length)
>    }
>
> }
>
> If I remove the  <at> CompileStatic then the program executes fine.  The
> specific error message is : "(class: CompilerBugs, method: main
> signature: ([Ljava/lang/String;)V) Expecting to find object/array on
> stack".  The bytecode that gets produced for the main method is:
>
> public static void main(java.lang.String[]);
>    Code:
(Continue reading)

Richard Warburton | 17 Jun 2012 11:59
Picon
Gravatar

Re: [groovy-dev] Potential Method Overloading bug in Groovy 2

> instructions at 25, try to call assertEquals with two array of objects and
> not with two objects
> and the two ints are boxed in arrays so it should work if
> Assert.assertEquals(Object[],Object[]) exist,
> but as far as I know, this method doesn't exist.

Ahh yes, I misread the signature.

> What is the exact error that the verifier raise ?

java.lang.VerifyError: (class: CompilerBugs, method: main signature:
([Ljava/lang/String;)V) Expecting to find object/array on stack

regards,

  Richard

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Cédric Champeau | 18 Jun 2012 09:15
Picon
Gravatar

Re: [groovy-dev] Potential Method Overloading bug in Groovy 2

It seems there are two bugs in one there: I am surprised the compiler 
chooses a method which doesn't exist (I don't even see how it is 
possible :D), and there's that VerifyError too. Can you raise a jira 
issue please?

Le 17/06/2012 11:59, Richard Warburton a écrit :
>> instructions at 25, try to call assertEquals with two array of objects and
>> not with two objects
>> and the two ints are boxed in arrays so it should work if
>> Assert.assertEquals(Object[],Object[]) exist,
>> but as far as I know, this method doesn't exist.
> Ahh yes, I misread the signature.
>
>> What is the exact error that the verifier raise ?
> java.lang.VerifyError: (class: CompilerBugs, method: main signature:
> ([Ljava/lang/String;)V) Expecting to find object/array on stack
>
> regards,
>
>    Richard
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>      http://xircles.codehaus.org/manage_email
>
>
>

--

-- 
(Continue reading)

Cédric Champeau | 18 Jun 2012 16:22
Picon
Gravatar

Re: [groovy-dev] Potential Method Overloading bug in Groovy 2

Created bug report: http://jira.codehaus.org/browse/GROOVY-5526

Le 17/06/2012 11:59, Richard Warburton a écrit :
instructions at 25, try to call assertEquals with two array of objects and not with two objects and the two ints are boxed in arrays so it should work if Assert.assertEquals(Object[],Object[]) exist, but as far as I know, this method doesn't exist.
Ahh yes, I misread the signature.
What is the exact error that the verifier raise ?
java.lang.VerifyError: (class: CompilerBugs, method: main signature: ([Ljava/lang/String;)V) Expecting to find object/array on stack regards, Richard --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email


-- Cédric Champeau SpringSource - A Division Of VMware http://www.springsource.com/ http://twitter.com/CedricChampeau

Gmane