You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Iurii (JIRA)" <ji...@apache.org> on 2017/05/25 10:05:04 UTC

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

Iurii created GROOVY-8205:
-----------------------------

             Summary: 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.3.15#6346)