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

@CompileStatic fails to compile when accessing boolean property using "isPropertyName()" getter method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1.3
    • 2.1.4
    • Static compilation
    • None
    • Windows 7, Java 6, Groovy 2.1.3

    Description

      The following code gives the error: [Static type checking] - The variable [booleanProperty] is undeclared. It works fine if the method is named "getBooleanProperty".

      MyClass.groovy
      @groovy.transform.CompileStatic
      class MyClass {
          MyClass() {
              println booleanProperty
          }
      
          // this works fine if we name this getter "getBooleanProperty"
          public boolean isBooleanProperty() {
              return true
          }
      }
      

      Attachments

        1. MyClass.groovy
          0.2 kB
          Brett Borchardt

        Activity

          People

            melix Cédric Champeau
            bborchardt Brett Borchardt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: