You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:35:00 UTC

[jira] [Closed] (GROOVY-10462) Groovy should not generate both `getFlag` and `isFlag` for a Boolean field.

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

Paul King closed GROOVY-10462.
------------------------------

> Groovy should not generate both `getFlag` and `isFlag` for a Boolean field.
> ---------------------------------------------------------------------------
>
>                 Key: GROOVY-10462
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10462
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 3.0.9
>            Reporter: Xiaoguang Wang
>            Assignee: Eric Milles
>            Priority: Critical
>             Fix For: 4.0.0-beta-1
>
>
> Before, Groovy 2 only generates one getter for a Boolean field.
> But now Groovy 3 generates two, it breaks some ORM frameworks (ex: MyBatis, it can not decide which getter to be used) and breaks JSON output.
> And the meaning of `isFlag` is wrong, it should not return `Boolean` in my mind.
>  
> {code:java}
> @CompileStatic
> class Foo {
>     Boolean flag
>     static void main(String[] args) {
>         Foo foo = new Foo()
>         println(foo.getFlag())
>         println(foo.isFlag())  // should not generate the `isFlag` getter
>     }
> }
>  {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)