You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Guillaume Laforge <gl...@gmail.com> on 2017/05/02 11:50:10 UTC

Fwd: Groovy Bug?

Hi,

Someone sent me the following email, showing a problem, which triggers an
interesting error message:
"This method should not have been called."

Coming from here:
https://github.com/apache/groovy/blob/183b8fbf0248a2dceffbba684e50c3c2c060e46c/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java#L643

Guillaume


---------- Forwarded message ----------
Date: Tue, May 2, 2017 at 10:37 AM
Subject: Groovy Bug?


Hello,

I am playing around with groovy and the map data type I then added the
CompileStatic annotation and I got the following result. Since I have no
deep knowledge of Groovy I can't judge what this means but since groovy
mentions I should issue a bug. I have not done this via jira since I don't
have an account there, but I think it is fair to inform you about this.


// Ececuted with C:/Tools/Groovy/bin/groovy.bat in the following environment

// Groovy Version: 2.4.10 JVM: 1.8.0_121 Vendor: Oracle Corporation OS:
Windows 7

// Output

// Caught: BUG! exception in phase 'class generation' in source unit
'B:\workspace\Groovy\NinjaGen\NinjaGenerator.groovy' At line 17 column 9

// On receiver: C_ASM_Files_m with message: leftShift and arguments:
(java.util.Map -> java.util.Map <K extends java.lang.Object, V extends
java.lang.Object>) FileListName_m.C_FILES

// This method should not have been called. Please try to create a simple
example reproducing

// this error and file a bug report at https://issues.apache.org/
jira/browse/GROOVY

// BUG! exception in phase 'class generation' in source unit
'B:\workspace\Groovy\NinjaGen\NinjaGenerator.groovy' At line 17 column 9

// On receiver: C_ASM_Files_m with message: leftShift and arguments:
(java.util.Map -> java.util.Map <K extends java.lang.Object, V extends
java.lang.Object>) FileListName_m.C_FILES

// This method should not have been called. Please try to create a simple
example reproducing

// this error and file a bug report at https://issues.apache.org/
jira/browse/GROOVY



import groovy.transform.TypeChecked

import groovy.transform.CompileStatic



@TypeChecked

@CompileStatic

class Main {



    static void main(String... args)

    {

        def FileListName_m    = [:]

        def Map C_ASM_Files_m = [:]

        def CFiles_m          = [:]



        CFiles_m['foo.c'] = 'bar.c'

        FileListName_m['C_FILES']   = CFiles_m



        C_ASM_Files_m << (Map)FileListName_m.C_FILES

    }

}



-- 
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Social: @glaforge <http://twitter.com/glaforge> / Google+
<https://plus.google.com/u/0/114130972232398734985/posts>

Re: Groovy Bug?

Posted by Guillaume Laforge <gl...@gmail.com>.
Yeah, the thing is we shouldn't be showing that message: either we raise an
error, or it's type checked properly.

On Tue, May 2, 2017 at 2:59 PM, Paul King <pa...@asert.com.au> wrote:

> Removing the @TypeChecked line will achieve what they want - should
> probably be raised as an error though.
>
> On Tue, May 2, 2017 at 9:50 PM, Guillaume Laforge <gl...@gmail.com>
> wrote:
>
>> Hi,
>>
>> Someone sent me the following email, showing a problem, which triggers an
>> interesting error message:
>> "This method should not have been called."
>>
>> Coming from here:
>> https://github.com/apache/groovy/blob/183b8fbf0248a2dceffbba
>> 684e50c3c2c060e46c/src/main/org/codehaus/groovy/classgen/asm/sc/
>> StaticTypesCallSiteWriter.java#L643
>>
>> Guillaume
>>
>>
>> ---------- Forwarded message ----------
>> Date: Tue, May 2, 2017 at 10:37 AM
>> Subject: Groovy Bug?
>>
>>
>> Hello,
>>
>> I am playing around with groovy and the map data type I then added the
>> CompileStatic annotation and I got the following result. Since I have no
>> deep knowledge of Groovy I can't judge what this means but since groovy
>> mentions I should issue a bug. I have not done this via jira since I don't
>> have an account there, but I think it is fair to inform you about this.
>>
>>
>> // Ececuted with C:/Tools/Groovy/bin/groovy.bat in the following
>> environment
>>
>> // Groovy Version: 2.4.10 JVM: 1.8.0_121 Vendor: Oracle Corporation OS:
>> Windows 7
>>
>> // Output
>>
>> // Caught: BUG! exception in phase 'class generation' in source unit
>> 'B:\workspace\Groovy\NinjaGen\NinjaGenerator.groovy' At line 17 column 9
>>
>> // On receiver: C_ASM_Files_m with message: leftShift and arguments:
>> (java.util.Map -> java.util.Map <K extends java.lang.Object, V extends
>> java.lang.Object>) FileListName_m.C_FILES
>>
>> // This method should not have been called. Please try to create a simple
>> example reproducing
>>
>> // this error and file a bug report at https://issues.apache.org/j
>> ira/browse/GROOVY
>>
>> // BUG! exception in phase 'class generation' in source unit
>> 'B:\workspace\Groovy\NinjaGen\NinjaGenerator.groovy' At line 17 column 9
>>
>> // On receiver: C_ASM_Files_m with message: leftShift and arguments:
>> (java.util.Map -> java.util.Map <K extends java.lang.Object, V extends
>> java.lang.Object>) FileListName_m.C_FILES
>>
>> // This method should not have been called. Please try to create a simple
>> example reproducing
>>
>> // this error and file a bug report at https://issues.apache.org/j
>> ira/browse/GROOVY
>>
>>
>>
>> import groovy.transform.TypeChecked
>>
>> import groovy.transform.CompileStatic
>>
>>
>>
>> @TypeChecked
>>
>> @CompileStatic
>>
>> class Main {
>>
>>
>>
>>     static void main(String... args)
>>
>>     {
>>
>>         def FileListName_m    = [:]
>>
>>         def Map C_ASM_Files_m = [:]
>>
>>         def CFiles_m          = [:]
>>
>>
>>
>>         CFiles_m['foo.c'] = 'bar.c'
>>
>>         FileListName_m['C_FILES']   = CFiles_m
>>
>>
>>
>>         C_ASM_Files_m << (Map)FileListName_m.C_FILES
>>
>>     }
>>
>> }
>>
>>
>>
>> --
>> Guillaume Laforge
>> Apache Groovy committer & PMC Vice-President
>> Developer Advocate @ Google Cloud Platform
>>
>> Blog: http://glaforge.appspot.com/
>> Social: @glaforge <http://twitter.com/glaforge> / Google+
>> <https://plus.google.com/u/0/114130972232398734985/posts>
>>
>
>


-- 
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Social: @glaforge <http://twitter.com/glaforge> / Google+
<https://plus.google.com/u/0/114130972232398734985/posts>

Re: Groovy Bug?

Posted by Paul King <pa...@asert.com.au>.
Removing the @TypeChecked line will achieve what they want - should
probably be raised as an error though.

On Tue, May 2, 2017 at 9:50 PM, Guillaume Laforge <gl...@gmail.com>
wrote:

> Hi,
>
> Someone sent me the following email, showing a problem, which triggers an
> interesting error message:
> "This method should not have been called."
>
> Coming from here:
> https://github.com/apache/groovy/blob/183b8fbf0248a2dceffbba684e50c3
> c2c060e46c/src/main/org/codehaus/groovy/classgen/asm/
> sc/StaticTypesCallSiteWriter.java#L643
>
> Guillaume
>
>
> ---------- Forwarded message ----------
> Date: Tue, May 2, 2017 at 10:37 AM
> Subject: Groovy Bug?
>
>
> Hello,
>
> I am playing around with groovy and the map data type I then added the
> CompileStatic annotation and I got the following result. Since I have no
> deep knowledge of Groovy I can't judge what this means but since groovy
> mentions I should issue a bug. I have not done this via jira since I don't
> have an account there, but I think it is fair to inform you about this.
>
>
> // Ececuted with C:/Tools/Groovy/bin/groovy.bat in the following
> environment
>
> // Groovy Version: 2.4.10 JVM: 1.8.0_121 Vendor: Oracle Corporation OS:
> Windows 7
>
> // Output
>
> // Caught: BUG! exception in phase 'class generation' in source unit
> 'B:\workspace\Groovy\NinjaGen\NinjaGenerator.groovy' At line 17 column 9
>
> // On receiver: C_ASM_Files_m with message: leftShift and arguments:
> (java.util.Map -> java.util.Map <K extends java.lang.Object, V extends
> java.lang.Object>) FileListName_m.C_FILES
>
> // This method should not have been called. Please try to create a simple
> example reproducing
>
> // this error and file a bug report at https://issues.apache.org/j
> ira/browse/GROOVY
>
> // BUG! exception in phase 'class generation' in source unit
> 'B:\workspace\Groovy\NinjaGen\NinjaGenerator.groovy' At line 17 column 9
>
> // On receiver: C_ASM_Files_m with message: leftShift and arguments:
> (java.util.Map -> java.util.Map <K extends java.lang.Object, V extends
> java.lang.Object>) FileListName_m.C_FILES
>
> // This method should not have been called. Please try to create a simple
> example reproducing
>
> // this error and file a bug report at https://issues.apache.org/j
> ira/browse/GROOVY
>
>
>
> import groovy.transform.TypeChecked
>
> import groovy.transform.CompileStatic
>
>
>
> @TypeChecked
>
> @CompileStatic
>
> class Main {
>
>
>
>     static void main(String... args)
>
>     {
>
>         def FileListName_m    = [:]
>
>         def Map C_ASM_Files_m = [:]
>
>         def CFiles_m          = [:]
>
>
>
>         CFiles_m['foo.c'] = 'bar.c'
>
>         FileListName_m['C_FILES']   = CFiles_m
>
>
>
>         C_ASM_Files_m << (Map)FileListName_m.C_FILES
>
>     }
>
> }
>
>
>
> --
> Guillaume Laforge
> Apache Groovy committer & PMC Vice-President
> Developer Advocate @ Google Cloud Platform
>
> Blog: http://glaforge.appspot.com/
> Social: @glaforge <http://twitter.com/glaforge> / Google+
> <https://plus.google.com/u/0/114130972232398734985/posts>
>