RFR: 8299502: Usage of constructors of primitive wrapper classes should be avoided in javax.xml API docs [v2]
Justin Lu
jlu at openjdk.org
Sat Jan 14 20:39:13 UTC 2023
On Sat, 14 Jan 2023 13:30:05 GMT, altrisi <duke at openjdk.org> wrote:
> I'd say in there it makes more sense given the method is used when you want a wrapper, and therefore explicitly converting it helps documentation, but here it's just setting a property, where I don't think it helps anything, just decreases readability as it seems like there may be a reason to call it explicitly with a wrapper and not a simple `true`/`false`.
In `setProperty(String name, Object value)`, the method is expecting `value` to be an Object. Like the other methods, it is a matter of passing the wrapper class or letting the primitive auto box. Passing true or false would have auto boxed boolean to Boolean.
The original statement before my change passed a Boolean, the consensus from the other PR was to pass the wrapper class, setProperty() is expecting `value` to be an Object, and the implementation of setProperty() casts `value` to be Boolean regardless. Those are the reasons why I picked the wrapper over the primitive.
I think an argument can be made for either way, and I don't necessarily believe one way is right or wrong, hope that helped.
-------------
PR: https://git.openjdk.org/jdk/pull/11872
More information about the core-libs-dev
mailing list