1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 567966 - CDT code clean up: type safety warnings

Generalize the type of elements and resolve type safety warnings

Change-Id: Id8e443d0c071bbd5447092099e80574cdf7fd9b3
Signed-off-by: Alexander Fedorov <alexander.fedorov@arsysop.ru>
This commit is contained in:
Alexander Fedorov 2020-10-24 18:38:54 +03:00
parent 5a2830648c
commit f2dcc3dff3

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2011 Texas Instruments Incorporated and others. * Copyright (c) 2005, 2020 Texas Instruments Incorporated and others.
* *
* This program and the accompanying materials * This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0 * are made available under the terms of the Eclipse Public License 2.0
@ -11,6 +11,7 @@
* Contributors: * Contributors:
* Texas Instruments - initial API and implementation * Texas Instruments - initial API and implementation
* IBM Corporation * IBM Corporation
* ArSysOp - rework to typed collections to fix type safety warnings
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.wizards; package org.eclipse.cdt.managedbuilder.ui.wizards;
@ -29,11 +30,11 @@ import org.eclipse.jface.wizard.IWizardPage;
*/ */
public final class MBSCustomPageData { public final class MBSCustomPageData {
private Set natureSet = null; private Set<String> natureSet = null;
private Set toolchainSet = null; private Set<ToolchainData> toolchainSet = null;
private Set projectTypeSet = null; private Set<String> projectTypeSet = null;
private IWizardPage wizardPage = null; private IWizardPage wizardPage = null;
@ -185,7 +186,7 @@ public final class MBSCustomPageData {
if (nature instanceof String) // old style if (nature instanceof String) // old style
return hasNature((String) nature); return hasNature((String) nature);
else if (nature instanceof Set) { else if (nature instanceof Set) {
Iterator it = ((Set) nature).iterator(); Iterator<?> it = ((Set<?>) nature).iterator();
while (it.hasNext()) { while (it.hasNext()) {
String s = it.next().toString(); String s = it.next().toString();
if (hasNature(s)) if (hasNature(s))
@ -229,9 +230,9 @@ public final class MBSCustomPageData {
if (toolchainSet.size() == 0) if (toolchainSet.size() == 0)
return true; return true;
Iterator iterator = toolchainSet.iterator(); Iterator<ToolchainData> iterator = toolchainSet.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ToolchainData tcd = (ToolchainData) iterator.next(); ToolchainData tcd = iterator.next();
// look for toolchain with same id. The id in the tool-chain data should never // look for toolchain with same id. The id in the tool-chain data should never
// contain a version suffix. // contain a version suffix.
if (tcd.getId().equals(id)) { if (tcd.getId().equals(id)) {
@ -259,12 +260,12 @@ public final class MBSCustomPageData {
ToolchainData[] tcd = new ToolchainData[toolchainSet.size()]; ToolchainData[] tcd = new ToolchainData[toolchainSet.size()];
Iterator iterator = toolchainSet.iterator(); Iterator<ToolchainData> iterator = toolchainSet.iterator();
int k = 0; int k = 0;
while (iterator.hasNext()) { while (iterator.hasNext()) {
tcd[k++] = (ToolchainData) iterator.next(); tcd[k++] = iterator.next();
} }
if (tcd.length > 0) if (tcd.length > 0)
return tcd; return tcd;
@ -303,7 +304,7 @@ public final class MBSCustomPageData {
return; return;
if (natureSet == null) if (natureSet == null)
natureSet = new TreeSet(); natureSet = new TreeSet<>();
natureSet.add(nature); natureSet.add(nature);
} }
@ -322,7 +323,7 @@ public final class MBSCustomPageData {
return; return;
if (toolchainSet == null) if (toolchainSet == null)
toolchainSet = new TreeSet(); toolchainSet = new TreeSet<>();
ToolchainData toolchainData = new ToolchainData(); ToolchainData toolchainData = new ToolchainData();
toolchainData.setId(toolchainID); toolchainData.setId(toolchainID);
@ -350,7 +351,7 @@ public final class MBSCustomPageData {
if (projectType instanceof String) if (projectType instanceof String)
return projectTypeSet.contains(projectType); return projectTypeSet.contains(projectType);
else if (projectType instanceof Set) { else if (projectType instanceof Set) {
Iterator it = ((Set) projectType).iterator(); Iterator<?> it = ((Set<?>) projectType).iterator();
while (it.hasNext()) { while (it.hasNext()) {
String s = it.next().toString(); String s = it.next().toString();
if (projectTypeSet.contains(s)) if (projectTypeSet.contains(s))
@ -372,7 +373,7 @@ public final class MBSCustomPageData {
return; return;
if (projectTypeSet == null) if (projectTypeSet == null)
projectTypeSet = new TreeSet(); projectTypeSet = new TreeSet<>();
projectTypeSet.add(projectType); projectTypeSet.add(projectType);
} }