[ https://issues.apache.org/jira/browse/GROOVY-5752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15409337#comment-15409337 ]
ASF GitHub Bot commented on GROOVY-5752: ---------------------------------------- GitHub user paulk-asert opened a pull request: https://github.com/apache/groovy/pull/380 GROOVY-5752: DelegateASTTransformation#addGetterIfNeeded doesn't take… … boolean isX accessors into account You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/groovy groovy5752 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/380.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #380 ---- commit 28750e13ab5f1c0115f59babfccb888d5ce1d7ff Author: paulk <pa...@asert.com.au> Date: 2016-08-05T11:17:22Z GROOVY-5752: DelegateASTTransformation#addGetterIfNeeded doesn't take boolean isX accessors into account ---- > DelegateASTTransformation#addGetterIfNeeded doesn't take boolean isX > accessors into account > ------------------------------------------------------------------------------------------- > > Key: GROOVY-5752 > URL: https://issues.apache.org/jira/browse/GROOVY-5752 > Project: Groovy > Issue Type: Bug > Components: xforms > Affects Versions: 2.0.5, 2.4.0-rc-1 > Reporter: Joris Kuipers > Assignee: Paul King > > I'm using @Delegate on a field whose type includes boolean properties. The > resulting byte code properly delegates non-overridden getters and setters, > but not boolean isX() accessors. This is due to > DelegateASTTransformation#addGetterIfNeeded not considering isX accessors. > Right now I've fixed this like this, wrapping the existing method in a for > loop iterating over both 'get' and 'is': > {code} > private void addGetterIfNeeded(FieldNode fieldNode, ClassNode owner, > PropertyNode prop, String name) { > for (String accessor: new String[] {"get", "is"}) { > String getterName = accessor + Verifier.capitalize(name); > if (owner.getGetterMethod(getterName) == null) { > owner.addMethod(getterName, > ACC_PUBLIC, > nonGeneric(prop.getType()), > Parameter.EMPTY_ARRAY, > null, > new ReturnStatement( > new PropertyExpression( > new > VariableExpression(fieldNode), > name))); > } > } > } > {code} > I could include a JUnit test, but the bug seems obvious enough looking at the > DelegateASTTransformation code. -- This message was sent by Atlassian JIRA (v6.3.4#6332)