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

Static type checking failure for enums

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.10
    • Fix Version/s: 2.5.0-beta-2
    • Component/s: Static Type Checker
    • Labels:
      None
    • Environment:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: