The GUI Builder produces code for boxed primitive properties that is deprecated for removal #7049
Labels
FormDesigner
GUI builder, also known as Matisse
Java
[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)
kind:bug
Bug report or fix
Apache NetBeans version
Apache NetBeans 20
What happened
When a JComponent has a property of type Long (not long) and a value is entered using the properties editor, the GUI Designer creates:
component.setProperty(new java.lang.Long(123L));
Since the Long(long) constructor is deprecated for removal and manual boxing is not required, the following code should be generated instead:
component.setProperty(123L);
This happens for all boxed primitive values except Boolean.
Furthermore, it is not possible to set a value to null using the Properties Editor. This also applies to Boolean.
Language / Project Type / NetBeans Component
Java
How to reproduce
Did this work correctly in an earlier version?
No / Don't know
Operating System
Windows / Linux
JDK
all since JDK 9
Apache NetBeans packaging
Apache NetBeans provided installer, Apache NetBeans binary zip
Anything else
No response
Are you willing to submit a pull request?
No
The text was updated successfully, but these errors were encountered: