Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8205

Static type checking failure for enums

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.10
    • 2.5.0-beta-2
    • Static Type Checker
    • None
    • Windows 7, JDK 1.8.0_66

    Description

      Declare enum:

      public enum Functions {
          A, B, C
      }
      

      Create test class, add the following test and try to compile:

          @Test
          @CompileStatic
          void testEachForEnum() {
              Functions.values().each { println it.name() }
          }
      

      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

      Attachments

        Issue Links

          Activity

            People

              jwagenleitner John Wagenleitner
              ichulovskyi Iurii
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: