You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Sterling Greene (Jira)" <ji...@apache.org> on 2022/07/28 03:35:00 UTC

[jira] [Commented] (GROOVY-10708) Property access for wrapped vs. primitive boolean

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

Sterling Greene commented on GROOVY-10708:
------------------------------------------

Here's the example we found in the Spring Boot plugin:
https://github.com/spring-projects/spring-boot/blob/57e967576eaaa8eda8d3d1ecb0fa072a7dc436bc/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/DockerSpec.java#L67-L77

The backing field is a boolean, the setter takes a boolean, it's just the getter that returns a Boolean.

When validating this task, Gradle looks at all of the "properties" and then looks at all of the other methods.  If those methods have annotations that don't make sense (e.g., {{@Input}}), we treat that as an error.  Groovy would count this as a property in <= Groovy 3.x and not in Groovy 4+.



> Property access for wrapped vs. primitive boolean
> -------------------------------------------------
>
>                 Key: GROOVY-10708
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10708
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.3
>            Reporter: Kyle Moore
>            Priority: Major
>
> In upgrading our codebase from Groovy 3.0.11 to 4.0.3, we noticed the documented change that {{isXyz}} accessors returning a {{Boolean}} are no longer recognized as properties.
> This has the potential to break a few use-cases in Gradle where accessors returning  {{Boolean}} are no longer included in {{MetaClass#getProperties()}}. We may be able to workaround this on our own, but are wondering if this behavior can be configured or modified in the 4.0.x timeline.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)