groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shil Sinha <shil.si...@gmail.com>
Subject Re: Internal compiler error when using for loop on a collection.
Date Thu, 29 Oct 2015 04:14:31 GMT
I was able to replicate the error with the following code:

interface Foo extends Iterable {
}

@groovy.transform.CompileStatic
void test(Foo foo) {
    for (x in foo) {
        println 'ok'
    }
}

In this example, the error occurs during class generation while writing the
`for` statement in the test(Foo) method.

The error no longer seems to occur as of Groovy 2.3.8.

On Wed, Oct 28, 2015 at 7:30 PM, Schalk Cronjé <ysb33r@gmail.com> wrote:

> No. I did not try a newer Groovy as it had to be the version that is
> bundled with Gradle 2.0.
>
> Actually the code  is now online
>
>
> https://github.com/ysb33r/groovy-vfs/blob/master/gradle-plugin/src/main/groovy/org/ysb33r/gradle/vfs/internal/UpToDateCheck.groovy#L55
>
> Replace that .each with a for loop and it fails with the below error.
>
>
>
> On 28/10/2015 22:41, Pascal Schumacher wrote:
>
>> Hard to say. Are using compile static? Did you try a newer groovy version?
>>
>> Am 27.10.2015 um 19:23 schrieb Schalk Cronjé:
>>
>>> To add a note to this. The exception does not occur when using .each on
>>> the collection.
>>>
>>> On 27/10/2015 17:32, Schalk Cronjé wrote:
>>>
>>>> I appreciate this might be hard to provide info on without the lack of
>>>> source code to look at, but I have not been able to distill this down to
a
>>>> simplified case. I am still working on a piece of new code for Groovy-VFS
>>>> so have not even pushed it upstream yet. However this compilation error has
>>>> caught me out.
>>>>
>>>> Maybe one of the Groovy Devs might have a clue as to what can cause
>>>> this kind of error.
>>>>
>>>> General error during class generation: Internal compiler error while
>>>> compiling **/**/UpToDateCheck.groovy
>>>> Method: MethodNode@1811575933[boolean
>>>> forUriCollection(org.gradle.api.logging.Logger,
>>>> org.ysb33r.groovy.dsl.vfs.VFS, org.ysb33r.gradle.vfs.VfsURICollection,
>>>> java.lang.Object)]
>>>> Line 35, expecting casting to java.util.Iterator <E extends
>>>> java.lang.Object> but operand stack is empty
>>>>
>>>> java.lang.ArrayIndexOutOfBoundsException: Internal compiler error while
>>>> compiling **/**/UpToDateCheck.groovy
>>>> Method: MethodNode@1811575933[boolean
>>>> forUriCollection(org.gradle.api.logging.Logger,
>>>> org.ysb33r.groovy.dsl.vfs.VFS, org.ysb33r.gradle.vfs.VfsURICollection,
>>>> java.lang.Object)]
>>>> Line 35, expecting casting to java.util.Iterator <E extends
>>>> java.lang.Object> but operand stack is empty
>>>>     at
>>>> org.codehaus.groovy.classgen.asm.OperandStack.throwExceptionForNoStackElement(OperandStack.java:310)
>>>>     at
>>>> org.codehaus.groovy.classgen.asm.OperandStack.doConvertAndCast(OperandStack.java:315)
>>>>     at
>>>> org.codehaus.groovy.classgen.asm.OperandStack.doGroovyCast(OperandStack.java:279)
>>>>     at
>>>> org.codehaus.groovy.classgen.asm.OperandStack.storeVar(OperandStack.java:629)
>>>>     at
>>>> org.codehaus.groovy.classgen.asm.CompileStack.defineTemporaryVariable(CompileStack.java:308)
>>>>     at org.codehaus.groovy.classgen.asm.sc
>>>> .StaticTypesStatementWriter.writeForInLoop(StaticTypesStatementWriter.java:85)
>>>>
>>>> It seems to be related to a for-loop over an internal Groovy VFS class
>>>> that implements the Iterable interface.
>>>>
>>>> The version of Groovy would be 2.3.3.
>>>>
>>>>
>>>
>>>
>>
>
> --
> Schalk W. Cronjé
> Twitter / Ello / Toeter : @ysb33r
>
>

Mime
View raw message