[ https://issues.apache.org/jira/browse/GROOVY-7940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15491883#comment-15491883 ]
ASF GitHub Bot commented on GROOVY-7940: ---------------------------------------- GitHub user jwagenleitner opened a pull request: https://github.com/apache/groovy/pull/420 GROOVY-7940: @Lazy not generating "is" property accessor for booleans You can merge this pull request into a Git repository by running: $ git pull https://github.com/jwagenleitner/groovy GROOVY-7940-lazy-booleans Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/420.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #420 ---- commit afdbc4b07fbad1d0596ed714a1f844faba870893 Author: John Wagenleitner <jwagenleit...@apache.org> Date: 2016-09-15T00:26:11Z GROOVY-7940: @Lazy not generating "is" property accessor for booleans ---- > Inconsistent handling of undocumented primitive data types at the @Lazy > annotation under use of extends > ------------------------------------------------------------------------------------------------------- > > Key: GROOVY-7940 > URL: https://issues.apache.org/jira/browse/GROOVY-7940 > Project: Groovy > Issue Type: Bug > Components: groovy-jdk > Affects Versions: 2.4.5 > Environment: Any > Reporter: Maik Igloffstein > Labels: data, extends, lazy, primitives, super, types > > *Documentation:* > http://docs.groovy-lang.org/latest/html/gapi/groovy/lang/Lazy.html > The documentations describes the usage of _@Lazy_ like: > {{@Lazy T x}} > I'm aware of that _T_ means no primitive data types, but groovy allows it and > generates the code - so why not. > {code} > class Super { > boolean aBoolean = true > int aInt = 5 > } > class Testing extends Super { > @Lazy > boolean aBoolean = { false }() > > @Lazy > int aInt = { 5 * 5 }() > } > println new Testing().isaBoolean() > println new Testing().getaBoolean() > println new Testing().getaInt() > println new Testing().aBoolean > println new Testing().aInt > {code} > Result: > {code} > true > false > 25 > true > 25 > {code} > The behavior is inconsistent. > boolean: results are from the super class > int: results are from the child class > -Please fix it or throw a _'RuntimeException'_ when primitive data types are > used.- > *Update:* > Please let _@Lazy_ implement \_is\_Boolean() instead of \_get\_Boolean() when > using primitive data type boolean and document it or just throw a > _'RuntimeException'_. -- This message was sent by Atlassian JIRA (v6.3.4#6332)