[
https://issues.apache.org/jira/browse/GROOVY-10621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17535125#comment-17535125
]
Eric Milles commented on GROOVY-10621:
--------------------------------------
You can remove “private” from restrictToPlayer and it will generate the getter.
You can then decide if you want to keep the isser or not. Or you could change
the return value of isRestrictToPlayer() to 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)