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

Static compiler allows property access on records but uses wrong method names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.1
    • 4.0.2
    • Static compilation
    • None

    Description

      When using the new record feature, Groovy creates methods that exactly match the property name (without the traditional get/is prefix): person.email(). In static code, the compiler permits traditional property-style access: person.email. However, in this case it generates a method call to Person.getEmail(), and this causes a NoSuchMethodError at runtime.

      Either the static compiler should error out because there's no visible JavaBean property, or it should generate code calling the record-style accessor.

      Attachments

        Activity

          People

            emilles Eric Milles
            chrylis Christopher Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: