juersimon opened a new issue, #7049:
URL: https://github.com/apache/netbeans/issues/7049
### 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
1. Create a JComponent that contains a property of type Long, Integer, etc.
`public class TextField extends JTextField {
private Long val1 = 123L;
public Long getVal1() {
return val1;
}
public void setVal1(Long val1) {
this.val1 = val1;
}
}
`
2. Create a new container (JPanel, JDialog etc.) using the GUI Designer and
add this component to the container.
3. Change the value of val1 using the property editor and view the generated
code.
4. Try setting the value of val1 to null using the property editor.
### 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
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists