This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243423

Summary: Unnecessary boxing to Integer in generated JSpinner code
Product: guibuilder Reporter: dacunur
Component: CodeAssignee: issues@guibuilder <issues>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 8 x64   
Issue Type: DEFECT Exception Reporter:

Description dacunur 2014-04-01 01:20:43 UTC
When you add a jSpinner via the GUI form builder and set the Model to "Number" with type "Integer" something along the following lines is created by netbeans:

spNumber.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), Integer.valueOf(0), null, Integer.valueOf(1)));

The cast to integer throws a warning message "Unnecessary boxing to Integer".

However if you define a "minimum value" and "maximum value", the code being generated seems to be correct:

spNumber.setModel(new javax.swing.SpinnerNumberModel(1, 0, 99999, 1));

If either "minimum value" or "maximum value" is not set, improper code is produced.
Comment 1 Tomas Pavek 2015-09-11 16:19:56 UTC
Actually fixed as bug 254218.

*** This bug has been marked as a duplicate of bug 254218 ***