Skip to content

Commit

Permalink
[NETBEANS-3670] - cleanup addElement() unchecked calls
Browse files Browse the repository at this point in the history
Cleanup a bunch of warnings related to uncheck call to addEelement()

[repeat] /home/bwalker/src/netbeans/platform/api.progress/src/org/netbeans/modules/progress/spi/TaskModel.java:67: warning: [unchecked] unchecked call to addElement(E) as a member of the raw type DefaultListModel
[repeat] model.addElement(handle);
[repeat] ^
[repeat] where E is a type-variable:
[repeat] E extends Object declared in class DefaultListModel
[repeat] 1 warning
  • Loading branch information
Brad Walker committed Jan 7, 2020
1 parent 07d4ace commit 7543f3b
Show file tree
Hide file tree
Showing 45 changed files with 79 additions and 77 deletions.
2 changes: 1 addition & 1 deletion apisupport/apisupport.wizards/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
javac.source=1.6
javac.source=1.8
javac.compilerargs=-Xlint -Xlint:-serial
requires.nb.javac=true
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void run() {
private void createPositionModel(final JComboBox positionsCombo,
final FileObject[] files,
final LayerItemPresenter parent) {
DefaultComboBoxModel newModel = new DefaultComboBoxModel();
DefaultComboBoxModel<Position> newModel = new DefaultComboBoxModel<>();
LayerItemPresenter previous = null;
for (FileObject file : files) {
if (file.getNameExt().endsWith(LayerUtil.HIDDEN)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.openide.windows.Mode;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error;

/**
* Main TopComponent to display the output of the Sun J2EE Verifier Tool from an archive file.
Expand Down Expand Up @@ -128,10 +129,10 @@ public class VerifierSupport extends TopComponent {
NbBundle.getMessage(VerifierSupport.class,STATUS_LIT),
NbBundle.getMessage(VerifierSupport.class,"Test_Description"), // NOI18N
NbBundle.getMessage(VerifierSupport.class,"Result")}; // NOI18N
private Vector passResults = new Vector();
private Vector failResults = new Vector();
private Vector errorResults = new Vector();
private Vector warnResults = new Vector();
private Vector<Test> passResults = new Vector<>();
private Vector<Test> failResults = new Vector<>();
private Vector<Error> errorResults = new Vector<>();
private Vector<Test> warnResults = new Vector<>();
private Vector naResults = new Vector();
private Vector notImplementedResults = new Vector();
private Vector notRunResults = new Vector();
Expand Down Expand Up @@ -882,7 +883,7 @@ public void saveFailResultsForDisplay(Test r){
*
* @param r
*/
public void saveErrorResultsForDisplay(org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error r){
public void saveErrorResultsForDisplay(Error r){
errorResults.addElement(r);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ final class ProjectServerPanel extends javax.swing.JPanel implements DocumentLis

private ProjectServerWizardPanel wizard;
private boolean contextModified = false;
private final DefaultComboBoxModel serversModel = new DefaultComboBoxModel();
private final DefaultComboBoxModel<ServerInstanceWrapper> serversModel = new DefaultComboBoxModel<>();

private J2eeVersionWarningPanel warningPanel;
private boolean sharableProject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.openide.windows.Mode;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error;

/**
* Main TopComponent to display the output of the Sun J2EE Verifier Tool from an archive file.
Expand Down Expand Up @@ -128,10 +129,10 @@ public class VerifierSupport extends TopComponent {
NbBundle.getMessage(VerifierSupport.class,STATUS_LIT),
NbBundle.getMessage(VerifierSupport.class,"Test_Description"), // NOI18N
NbBundle.getMessage(VerifierSupport.class,"Result")}; // NOI18N
private Vector passResults = new Vector();
private Vector failResults = new Vector();
private Vector errorResults = new Vector();
private Vector warnResults = new Vector();
private Vector<Test> passResults = new Vector<>();
private Vector<Test> failResults = new Vector<>();
private Vector<Test> warnResults = new Vector<>();
private Vector<Error> errorResults = new Vector<>();
private Vector naResults = new Vector();
private Vector notImplementedResults = new Vector();
private Vector notRunResults = new Vector();
Expand Down Expand Up @@ -882,7 +883,7 @@ public void saveFailResultsForDisplay(Test r){
*
* @param r
*/
public void saveErrorResultsForDisplay(org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error r){
public void saveErrorResultsForDisplay(Error r){
errorResults.addElement(r);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*/
public class WebClasspathPanel extends javax.swing.JPanel implements HelpCtx.Provider {

private DefaultListModel listModel;
private DefaultListModel<String> listModel;
/** Original project folder (not nbproject folder) */
private File projectFolder = null;
/** Freeform Project base folder */
Expand Down Expand Up @@ -263,9 +263,9 @@ private void moveDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
}
for (int i = 0; i < indices.length; i++) {
int index = indices[i];
Object o = listModel.remove(index);
String s = listModel.remove(index);
index++;
listModel.add(index, o);
listModel.add(index, s);
indices[i] = index;
}
classpath.setSelectedIndices(indices);
Expand All @@ -279,9 +279,9 @@ private void moveUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:
}
for (int i = 0; i < indices.length; i++) {
int index = indices[i];
Object o = listModel.remove(index);
String s = listModel.remove(index);
index--;
listModel.add(index, o);
listModel.add(index, s);
indices[i] = index;
}
classpath.setSelectedIndices(indices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public AddFrameworkPanel(List usedFrameworks) {

private void createFrameworksList(List usedFrameworks) {
List frameworks = WebFrameworks.getFrameworks();
DefaultListModel model = new DefaultListModel();
DefaultListModel<WebFrameworkProvider> model = new DefaultListModel<>();
jListFrameworks.setModel(model);

for (int i = 0; i < frameworks.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ public void setBooleanRenderer(TableCellRenderer booleanRenderer) {
* Implements a TableModel.
*/
public static final class FrameworksTableModel extends AbstractTableModel {
private DefaultListModel model;
private DefaultListModel<FrameworkModelItem> model;

public FrameworksTableModel() {
model = new DefaultListModel();
model = new DefaultListModel<>();
}

public int getColumnCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public AddActionPanel(StrutsConfigDataObject dObject) {
config=dObject;
initComponents();
List actions = StrutsConfigUtilities.getAllActionsInModule(dObject);
DefaultComboBoxModel model = (DefaultComboBoxModel)CBInputAction.getModel();
DefaultComboBoxModel<String> model = (DefaultComboBoxModel)CBInputAction.getModel();
Iterator iter = actions.iterator();
while (iter.hasNext())
model.addElement(((Action)iter.next()).getAttributeValue("path")); //NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public AddForwardDialogPanel(StrutsConfigDataObject config, String targetActionP
this.config=config;
initComponents();
List actions = StrutsConfigUtilities.getAllActionsInModule(config);
DefaultComboBoxModel model = (DefaultComboBoxModel)jComboBoxFwdAction.getModel();
DefaultComboBoxModel model1 = (DefaultComboBoxModel)jComboBoxLocationAction.getModel();
DefaultComboBoxModel<String> model = (DefaultComboBoxModel<String>)jComboBoxFwdAction.getModel();
DefaultComboBoxModel<String> model1 = (DefaultComboBoxModel<String>)jComboBoxLocationAction.getModel();
Iterator iter = actions.iterator();
while (iter.hasNext()) {
String actionPath=((Action)iter.next()).getAttributeValue("path"); //NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public final class DebuggerManager implements ContextProvider {
private final Vector breakpoints = new Vector ();
private boolean breakpointsInitializing = false;
private boolean breakpointsInitialized = false;
private final Vector watches = new Vector ();
private final Vector<Watch> watches = new Vector<>();
private boolean watchesInitialized = false;
private ThreadLocal<Boolean> watchesInitializing = new ThreadLocal<Boolean>();
private SessionListener sessionListener = new SessionListener ();
Expand Down Expand Up @@ -706,7 +706,7 @@ public void reorderWatches(final int[] permutation) throws IllegalArgumentExcept
throw new IllegalArgumentException("Permutation of length "+permutation.length+", but have "+watches.size()+" watches.");
}
checkPermutation(permutation);
Vector v = (Vector) watches.clone ();
Vector<Watch> v = (Vector<Watch>)watches.clone();
for (int i = 0; i < v.size(); i++) {
watches.set(permutation[i], v.get(i));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public CssRuleCreateActionDialog() {
String[] htmlTags = HtmlTags.getTags();

// Optional prefix
DefaultComboBoxModel htmlTagsModel1 = new DefaultComboBoxModel();
DefaultComboBoxModel<String> htmlTagsModel1 = new DefaultComboBoxModel<>();
htmlTagsModel1.addElement(NONE);
htmlTagsModel1.addElement("a:link");
htmlTagsModel1.addElement("a:visited");
Expand Down
2 changes: 1 addition & 1 deletion ide/languages/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
build.compiler.deprecation=false
is.autoload=true
javac.compilerargs=-Xlint:unchecked
javac.source=1.6
javac.source=1.8
javadoc.arch=${basedir}/arch.xml
spec.version.base=1.128.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public GLFFilesCustomEditor () {
initComponents ();
List<String> mimeTypes = getSupportedMimeTypes ();
Collections.sort (mimeTypes);
DefaultListModel model = new DefaultListModel ();
DefaultListModel<String> model = new DefaultListModel<>();
Iterator<String> it = mimeTypes.iterator ();
while (it.hasNext ()) {
String name = (String) it.next ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ Collection<SearchHighlight> getSearchHighlights () {
}

private void initializeFilter () {
DefaultComboBoxModel filterModel = new DefaultComboBoxModel();
DefaultComboBoxModel<FilterKind> filterModel = new DefaultComboBoxModel<>();
filterModel.addElement(FilterKind.ALL);
filterModel.addElement(FilterKind.ID);
filterModel.addElement(FilterKind.MESSAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ private class InitialLoadingProgressSupport extends HgProgressSupport {
@Override
public void perform () {
try {
final DefaultListModel targetsModel = new DefaultListModel();
final DefaultListModel<HgLogMessage> targetsModel = new DefaultListModel<>();
final HgLogMessage displayedRevision = getDisplayedRevision();
if (displayedRevision == null) {
if (acceptSelection(NO_REVISION)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Component getListCellRendererComponent(JList list, Object value, int inde
}

void update () {
DefaultComboBoxModel model = new DefaultComboBoxModel();
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
for (String mimeType : controller.getMimeTypes()) {
model.addElement(mimeType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void setSelector(CustomizerSelector selector) {

if (this.selector != null) {
// Languages combobox model
DefaultComboBoxModel model = new DefaultComboBoxModel();
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
ArrayList<String> mimeTypes = new ArrayList<String>();
mimeTypes.addAll(selector.getMimeTypes());
Collections.sort(mimeTypes, new LanguagesComparator());
Expand Down Expand Up @@ -142,7 +142,7 @@ public void setSelector(CustomizerSelector selector) {

public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName() == null || CustomizerSelector.PROP_MIMETYPE.equals(evt.getPropertyName())) {
DefaultComboBoxModel model = new DefaultComboBoxModel();
DefaultComboBoxModel<PreferencesCustomizer> model = new DefaultComboBoxModel();
List<? extends PreferencesCustomizer> nue = selector.getCustomizers(selector.getSelectedMimeType());
int preSelectIndex = 0;
int idx = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private void btnProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI

private void loadGlobalLicenses() {
FileObject root = FileUtil.getConfigFile("Templates/Licenses");
DefaultComboBoxModel model = new DefaultComboBoxModel();
DefaultComboBoxModel<GlobalItem> model = new DefaultComboBoxModel<>();
for (FileObject fo : root.getChildren()) {
if (fo.getAttribute("template") == null) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ final public class ExitDialog extends JPanel implements ActionListener {
private static boolean result = false;

JList list;
DefaultListModel listModel;
DefaultListModel<DataObject> listModel;

/** Constructs new dlg for unsaved files in filesystems marked
* for unmount.
*/
private ExitDialog (Set<DataObject> openedFiles) {
setLayout (new BorderLayout ());

listModel = new DefaultListModel();
listModel = new DefaultListModel<>();

Set<DataObject> set = getModifiedFiles (openedFiles);
if (!set.isEmpty ()) {
Expand Down
2 changes: 1 addition & 1 deletion ide/spellchecker/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# under the License.
#
javac.compilerargs=-Xlint:unchecked
javac.source=1.6
javac.source=1.8
nbm.homepage=http://spellchecker.netbeans.org
nbm.module.author=Jan Lahoda
spec.version.base=1.42.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ private void defaultLocaleItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-
// End of variables declaration//GEN-END:variables

private ListModel getInstalledDictionariesModel() {
DefaultListModel dlm = new DefaultListModel();
DefaultListModel<Locale> dlm = new DefaultListModel<>();

for (Locale l : DictionaryProviderImpl.getInstalledDictionariesLocales()) {
dlm.addElement(l);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ String getSelectedPath () {
}

private void initializeItems () {
DefaultListModel model = new DefaultListModel();
DefaultListModel<String> model = new DefaultListModel<>();
model.addElement(ITEM_BRANCHES);
model.addElement(ITEM_LOADING);
model.addElement(ITEM_SEP);
Expand Down Expand Up @@ -141,7 +141,7 @@ protected void perform () {

@Override
public void run () {
DefaultListModel model = new DefaultListModel();
DefaultListModel<String> model = new DefaultListModel<>();
model.addElement(ITEM_BRANCHES);
for (ISVNDirEntry e : entries.get(PREFIX_BRANCHES)) {
model.addElement(branchesFolderPrefix + PREFIX_BRANCHES + "/" + e.getPath()); //NOI18N
Expand Down
2 changes: 1 addition & 1 deletion ide/tasklist.ui/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
javac.compilerargs=-Xlint:unchecked
javac.source=1.6
javac.source=1.8
spec.version.base=1.38.0

test.config.stableBTD.includes=**/*Test.class
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public AttachmentPanel(AttachmentsPanel.NBBugzillaCallback nbCallback) {
}

private void initFileTypeCombo() {
DefaultComboBoxModel model = new DefaultComboBoxModel();
DefaultComboBoxModel<FileType> model = new DefaultComboBoxModel<>();
ResourceBundle bundle = NbBundle .getBundle(AttachmentPanel.class);
model.addElement(new FileType(null, bundle.getString("AttachmentPanel.fileType.automatic"))); // NOI18N
model.addElement(new FileType("text/plain", bundle.getString("AttachmentPanel.fileType.textPlain"))); // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private ListValuePicker(String label, String message, ListValue[] knownValues, S
org.openide.awt.Mnemonics.setLocalizedText(valuesLabel, label);

valuesList.setCellRenderer(new ListValueRenderer());
DefaultListModel model = new DefaultListModel();
DefaultListModel<ListValue> model = new DefaultListModel<>();
for (ListValue lvalue : knownValues) {
model.addElement(lvalue);
}
Expand Down
2 changes: 1 addition & 1 deletion ide/versioning.ui/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

is.eager=true
javac.compilerargs=-Xlint:unchecked
javac.source=1.6
javac.source=1.8

spec.version.base=1.29.0
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Collection<String> getKeywords () {
private void fillDisconnectedFolders () {
if (cmbVersioningSystems.getSelectedItem() instanceof VersioningSystem) {
String[] disconnected = Utils.getDisconnectedRoots(((VersioningSystem) cmbVersioningSystems.getSelectedItem()));
DefaultListModel model = new DefaultListModel();
DefaultListModel<String> model = new DefaultListModel<>();
for (String f : disconnected) {
model.addElement(f);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void intialize( Lookup context ) {
panel.add( bar );

//ZOOM combo box
DefaultComboBoxModel zoomModel = new DefaultComboBoxModel();
DefaultComboBoxModel<String> zoomModel = new DefaultComboBoxModel<>();
zoomModel.addElement( "200%" ); //NOI18N
zoomModel.addElement( "150%" ); //NOI18N
zoomModel.addElement( "100%" ); //NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CreateRelationshipPanel extends javax.swing.JPanel {
public enum NameStatus {VALID, ILLEGAL_JAVA_ID, ILLEGAL_SQL_KEYWORD, DUPLICATE};
public enum AvailableSelection {INVERSE_ONLY, OWNING_ONLY, BOTH};
private Collection<String> availableFields;
private DefaultComboBoxModel mdlAvailableFields = new DefaultComboBoxModel();
private DefaultComboBoxModel<String> mdlAvailableFields = new DefaultComboBoxModel<>();
private FieldNameValidator nameValidator = null;
private Border brdrBlack = BorderFactory.createLineBorder(Color.BLACK);
private DialogDescriptor dlgDescriptor = null;
Expand Down
Loading

0 comments on commit 7543f3b

Please sign in to comment.