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.
Now, when we switched to Java 7, javac complains while building Matisse classes: warning: [rawtypes] found raw type: JList BTW I prefer DEFECT since there is no way to avoid such warnings (I mean for Matisse code) in the log - or is it? Thanks. Product Version: NetBeans IDE 7.3 (Build 201302132200) Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02 System: Linux version 3.5.0-26-generic running on amd64; UTF-8; cs_CZ (nb)
A way to fix this is to open the GUI form, select JList component, go to Code properties and set "Type Parameters" property to <Object>. A fix in GUI builder could be to set the property automatically when adding a new JList component (on JDK 7+). I don't think the GUI builder should try to do that for existing forms. BTW there are typically other warnings from user code when using the JList (like from setModel or setCellRenderer) which need to be fixed manually as well. Or adjust the level of compile warnings produced by the NetBeans build. E.g. in a standard Java SE project I don't see the warnings. It seems to be a specialty of the NBM projects.
Tome, thanks a lot for perfect information, as always.
To fix this, the GUI builder should automatically set <Object> or <String> as the type parameter for JComboBox and JList newly added to the form and then also generate the diamond <> in constructor call a in code that creates the models. So e.g.: private javax.swing.JComboBox<String> jComboBox1; jComboBox1 = new javax.swing.JComboBox<>(); jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); For existing (old) forms with no type parameter set we should probably not generate the diamonds in component and model constructors (though the code compiles either way). For old forms with no type parameter we probably cannot detect it reliably - the user will have to set it manually to get rid of compile warnings.
*** Bug 250588 has been marked as a duplicate of this bug. ***
Also related: bug 223998.
*** Bug 255189 has been marked as a duplicate of this bug. ***
*** Bug 250586 has been marked as a duplicate of this bug. ***
Made a fix so that newly added JList and JComboBox have automatically <Object> type parameter set and <> is correctly generated for constructor and model. To fix old forms containing lists/combo boxes without type parameter it should be enough to set it manually to Object (in Code tab, Type Parameters property) and that should get rid of all compile warnings. For existing forms that have the type parameters set by user, to get the <> generated (e.g. instead of current superfluous new javax.swing.JComboBox<String>()), it should be enough to do whatever change in an opened GUI form to trigger code regeneration. http://hg.netbeans.org/jet-main/rev/b9a55880ddde
Integrated into 'main-silver', will be available in build *201509160002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/b9a55880ddde User: Tomas Pavek <tpavek@netbeans.org> Log: #227943: automatically set type parameter for JList and JComboBox, use diamond in generated code where it should be