paulk-asert commented on pull request #1597: URL: https://github.com/apache/groovy/pull/1597#issuecomment-859957210
It would be nice to make this consistent. It is a tricky area though. The JavaBean spec[1] seems to indicate that the "is" method should have precedence: > This “is\<PropertyName\>” method may be provided instead of a “get\<PropertyName\>” method, or it may be provided in addition to a “get\<PropertyName>” method. > In either case, if the “is\<PropertyName>” method is present for a boolean property then we will > use the “is\<PropertyName>” method to read the property value. That also seems to be how the JavBean Introspector behaves: ``` import java.beans.Introspector class Bean { void setFlag(boolean flag) {} boolean isFlag() {} boolean getFlag() {} } def props = Introspector.getBeanInfo(Bean).propertyDescriptors assert 'isFlag' == props.find{ it.baseName == 'Flag' }.readMethod.name ``` [1] https://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org