You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[java] BooleanGetMethodName should have the option to treat boolean wrapper type differently #6958
The change introduced in #5253 was made under the assumption that returning a (primitive) boolean and a (wrapped) Boolean should both be treated the same (and not use the get prefix).
Although they are similar, there are still a number of tools, including those following the Java Beans convention, that expect getFoo to be used when the wrapped Boolean type is used.
Accessing isRed() -> boolean:
true
Accessing getGreen() -> Boolean:
true
Accessing isBlue() -> Boolean:
Exception in thread "main" java.lang.NoSuchMethodException: Unknown property 'blue' on class 'class Test$Item'
at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1232)
at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:783)
at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:811)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:396)
at Test.main(Test.java:38)
This will throw an exception when trying to get the "blue" property, because isBlue() is returning a wrapped Boolean and not a primitive type.
This works for getGreen(), because it uses the "get" prefix.
When using Boolean (and not boolean), using the "get" prefix is by design in many cases.
I would suggest either to reverse #5253, or to add an option to distinguish the wrapped type case (for includeWrappedType or excludeWrappedType, depending on what the default should be).
changed the title [-]BooleanGetMethodName should have the option to treat boolean wrapper type differently[/-][+][java] BooleanGetMethodName should have the option to treat boolean wrapper type differently[/+]on Aug 7, 2026
Activity
[-]BooleanGetMethodName should have the option to treat boolean wrapper type differently[/-][+][java] BooleanGetMethodName should have the option to treat boolean wrapper type differently[/+]