Dmitry created GROOVY-10621:
-------------------------------

             Summary: 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


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)

Reply via email to