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

Jochen Theodorou commented on GROOVY-7940:
------------------------------------------

The problem is more that @Lazy adds a getaBoolean Method and not isaBoolean 
method. And that isaBoolean() is preferred over getaBoolean(). If you change 
your test to use getaBoolean it will look different

> 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().getaInt()
> println new Testing().aBoolean
> println new Testing().aInt
> {code}
> Result:
> {code}
> true
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to