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 254218

Summary: Unnecessary boxing in generated JSpinner code
Product: guibuilder Reporter: Foolfire
Component: CodeAssignee: issues@guibuilder <issues>
Status: RESOLVED FIXED    
Severity: normal CC: dacunur
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:

Description Foolfire 2015-08-09 00:27:41 UTC
Product Version = NetBeans IDE 8.0.2 (Build 201411181905)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.7.0_79
Runtime = Java HotSpot(TM) Client VM 24.79-b02
Comment 1 Foolfire 2015-08-09 00:34:52 UTC
I'm using NetBeans 8.0.2 with latest updates for developing projects on Java.
I would like to report some kind of workaround.

When I'm doing any changes with any component of the form @ design editor,
for any JSpinner component on the form the following code will be automatically generated:
"<JSpinner's identifier>.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));"

Code editor then will show warning hint "Unnecessary boxing to Integer" for this string of the code.

If I will replace "Integer.ValueOf(0)" with just 0 and save changes, code will remain unchanged until next changes on the form @ design editor,
when code with "Integer.valueOf(0)" will be automatically generated and replaced back once again.
Comment 2 Foolfire 2015-08-09 09:47:03 UTC
spinner model in "model" property editor was set as

property using: Spinner Model Editor
Model Type = Number
Number Type = Integer
Initial Value = 0
Minimum = 0 //checked
Maximum = 0 //uncheked
Step Size = 1
Comment 3 Tomas Pavek 2015-09-09 16:05:45 UTC
Fixed.

http://hg.netbeans.org/jet-main/rev/3c519a7f3583
Comment 4 Quality Engineering 2015-09-10 01:28:08 UTC
Integrated into 'main-silver', will be available in build *201509100002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3c519a7f3583
User: Tomas Pavek <tpavek@netbeans.org>
Log: #254218: if either minumum or maximum spinner value is null, we can rely on autoboxing in generated code
Comment 5 Tomas Pavek 2015-09-11 16:19:56 UTC
*** Bug 243423 has been marked as a duplicate of this bug. ***