You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/07/23 16:27:00 UTC

[jira] [Updated] (GROOVY-10548) Static compiler allows property access on records but uses wrong method names

     [ https://issues.apache.org/jira/browse/GROOVY-10548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-10548:
---------------------------------
    Fix Version/s:     (was: 5.0.0-alpha-1)

> Static compiler allows property access on records but uses wrong method names
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-10548
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10548
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 4.0.1
>            Reporter: Christopher Smith
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.2
>
>
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)