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/05/11 22:07:00 UTC
[jira] [Comment Edited] (GROOVY-10621) Why isAttribute style getters have gone from groovy 4
[ https://issues.apache.org/jira/browse/GROOVY-10621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17535124#comment-17535124 ]
Eric Milles edited comment on GROOVY-10621 at 5/11/22 10:06 PM:
----------------------------------------------------------------
This was an intentional change. Boolean property generates getter method and boolean (primitive) generates getter and isser. And “name” only resolves to “isName()” if return value is boolean.
was (Author: emilles):
This was an intentional change. Boolean property generates getter method and boolean (primitive) generates getter and isser. And “name” only resolved to “isName()” if return value is boolean.
> Why isAttribute style getters have gone from groovy 4
> -----------------------------------------------------
>
> Key: GROOVY-10621
> URL: https://issues.apache.org/jira/browse/GROOVY-10621
> Project: Groovy
> Issue Type: Bug
> Reporter: Dmitry
> Priority: Blocker
>
> I use groovy 2.5.15 and try 3 version groovy - isAttribute style getters work correct.
> But when I upgrade groovy for 4 version - isAttribute style getters are disappeared.
> I has auto-genereted class:
>
> {code:java}
> class CheckoutVoucherDTO implements _DTOTrait, CheckoutVoucherDTOTrait {
> private Boolean restrictToPayer = null
> Boolean isRestrictToPayer() {
> return restrictToPayer
> }
> void setRestrictToPayer(Boolean restrictToPayer) {
> this.restrictToPayer = restrictToPayer
> }
> } {code}
>
>
> And use:
>
> {code:java}
> if (dto.restrictToPayer) {
> //logic
> } {code}
> But in groovy 4 I catch exception: "Access to ish.oncourse.server.api.v1.model.CheckoutVoucherDTO#restrictToPayer is forbidden"
> When I add method:
>
> {code:java}
> Boolean getRestrictToPayer() { return restrictToPayer } {code}
> it work. But I has 2 nuances:
>
> # It is auto-genereted code and it is use in another not only groovy but in java classes too.
> # I has a lot of places using isAttribute syntax and it is impossible to rewrite all with dto.isRestrictToPayer()
>
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)