[ 
https://issues.apache.org/jira/browse/GROOVY-7940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15500224#comment-15500224
 ] 

ASF GitHub Bot commented on GROOVY-7940:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/420


> 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)

Reply via email to