You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "John Wagenleitner (JIRA)" <ji...@apache.org> on 2017/08/26 18:25:01 UTC

[jira] [Commented] (GROOVY-8205) Static type checking failure for enums

    [ https://issues.apache.org/jira/browse/GROOVY-8205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16142881#comment-16142881 ] 

John Wagenleitner commented on GROOVY-8205:
-------------------------------------------

This particular issue was fixed by [commit 8c218dec34|https://github.com/apache/groovy/commit/8c218dec34730e92eb020cbb1b0888dcc89bd35b] for GROOVY-7283 which is part of the 2.5 release.

> Static type checking failure for enums
> --------------------------------------
>
>                 Key: GROOVY-8205
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8205
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.4.10
>         Environment: Windows 7, JDK 1.8.0_66
>            Reporter: Iurii
>
> Declare enum:
> {code}
> public enum Functions {
>     A, B, C
> }
> {code}
> Create test class, add the following test and try to compile:
> {code}
>     @Test
>     @CompileStatic
>     void testEachForEnum() {
>         Functions.values().each { println it.name() }
>     }
> {code}
> Result: Groovyc: [Static type checking] - Cannot find matching method java.lang.Object#name(). Please check if the declared type is right and if the method exists.
> Expected: code should compile without errors



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)