Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-24 11:30:50 +0000
committerJonah Graham2018-11-24 11:32:04 +0000
commit3859b78b71da07b2588c81f5ee6bdbb4f0f7f0ba (patch)
tree7cc3ed2aef56b6278ca659c4d03f4f98b4f67737
parentf869a3f247afc6030a6d559996cd9e3ffb920a12 (diff)
downloadorg.eclipse.cdt-3859b78b71da07b2588c81f5ee6bdbb4f0f7f0ba.tar.gz
org.eclipse.cdt-3859b78b71da07b2588c81f5ee6bdbb4f0f7f0ba.tar.xz
org.eclipse.cdt-3859b78b71da07b2588c81f5ee6bdbb4f0f7f0ba.zip
Bug 540373: Cleanup warnings in tests
- Remove redundant super-interfaces - Remove redundant null checks - Remove redundant instanceof checks Change-Id: I3e8adba818b58f8ae5b43682ace74812db5b9bb4
-rw-r--r--core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java6
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java3
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeLeaf.java23
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeParent.java5
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/FindIASTNameTarget.java9
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestExtraPagesProvider.java2
6 files changed, 19 insertions, 29 deletions
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java
index a33b3fbb76c..db0b661bce2 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java
@@ -59,7 +59,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
private static final boolean READ_ONLY = false;
private static final boolean WRITEABLE = true;
- private class MockProvider extends LanguageSettingsBaseProvider implements ILanguageSettingsProvider {
+ private class MockProvider extends LanguageSettingsBaseProvider {
private final List<ICLanguageSettingEntry> entries;
public MockProvider(String id, String name, List<ICLanguageSettingEntry> entries) {
@@ -784,7 +784,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
* Test from parent folder's entries.
*/
public void testParentFolder() throws Exception {
- class MockProviderForResource extends LanguageSettingsBaseProvider implements ILanguageSettingsProvider {
+ class MockProviderForResource extends LanguageSettingsBaseProvider {
private IResource rc;
private final List<ICLanguageSettingEntry> entries;
@@ -911,7 +911,7 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
* Test composition of 2 languages.
*/
public void testResourceLanguages() throws Exception {
- class MockProviderLang extends LanguageSettingsBaseProvider implements ILanguageSettingsProvider {
+ class MockProviderLang extends LanguageSettingsBaseProvider {
private final String langId;
private final List<ICLanguageSettingEntry> entries;
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java
index 20b6b3e0cba..9e8cda23e59 100644
--- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java
+++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java
@@ -77,7 +77,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
@@ -165,7 +164,7 @@ public class DOMAST extends ViewPart {
* ignore it and always show the same content (like Task List, for example).
*/
- public class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider {
+ public class ViewContentProvider implements ITreeContentProvider {
private static final String POPULATING_AST_VIEW = "Populating AST View"; //$NON-NLS-1$
private DOMASTNodeParent invisibleRoot;
private DOMASTNodeParent tuTreeParent = null;
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeLeaf.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeLeaf.java
index eadac4a534f..8589630812d 100644
--- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeLeaf.java
+++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeLeaf.java
@@ -474,18 +474,17 @@ public class DOMASTNodeLeaf implements IAdaptable {
text = new TextPropertyDescriptor(NODE_PREFIX + methods[j].getName(),
methods[j].getName() + EMPTY_PARAMETER);
- if (text != null) {
- if (obj instanceof IBinding)
- text.setCategory(IBINDING_TAG
- + ((IASTName) node).resolveBinding().getClass().getName()
- .substring(((IASTName) node).resolveBinding().getClass().getName()
- .lastIndexOf(PERIOD) + 1)
- + COLON_SEPARATOR + getValueString(((IASTName) node).resolveBinding()));
- else
- text.setCategory(objClass.getName().substring(objClass.getName().lastIndexOf(PERIOD) + 1)
- + COLON_SEPARATOR + getValueString(node));
- desc = ArrayUtil.append(IPropertyDescriptor.class, desc, text);
- }
+ if (obj instanceof IBinding)
+ text.setCategory(
+ IBINDING_TAG
+ + ((IASTName) node).resolveBinding().getClass().getName()
+ .substring(((IASTName) node).resolveBinding().getClass().getName()
+ .lastIndexOf(PERIOD) + 1)
+ + COLON_SEPARATOR + getValueString(((IASTName) node).resolveBinding()));
+ else
+ text.setCategory(objClass.getName().substring(objClass.getName().lastIndexOf(PERIOD) + 1)
+ + COLON_SEPARATOR + getValueString(node));
+ desc = ArrayUtil.append(IPropertyDescriptor.class, desc, text);
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeParent.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeParent.java
index 578f6b4cd71..44d858dcbfe 100644
--- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeParent.java
+++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMASTNodeParent.java
@@ -294,9 +294,8 @@ public class DOMASTNodeParent extends DOMASTNodeLeaf {
// try finding the best parent possible
IASTNode parent = node.getParent();
- DOMASTNodeParent tree = null;
- while (parent != null && tree == null) {
- tree = findTreeParentForNode(parent);
+ while (parent != null) {
+ DOMASTNodeParent tree = findTreeParentForNode(parent);
if (tree != null)
return tree;
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/FindIASTNameTarget.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/FindIASTNameTarget.java
index cff7352c1ba..2b144359c6c 100644
--- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/FindIASTNameTarget.java
+++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/FindIASTNameTarget.java
@@ -142,14 +142,7 @@ public class FindIASTNameTarget implements IFindReplaceTarget, IFindReplaceTarge
}
// convert the array list into an array of IASTNames
- IASTName[] namedArray = new IASTName[nameList.size()];
-
- for (int i = 0; i < nameList.size(); i++) {
- if (nameList.get(i) instanceof IASTName)
- namedArray[i] = nameList.get(i);
- }
-
- return namedArray;
+ return nameList.toArray(new IASTName[nameList.size()]);
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestExtraPagesProvider.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestExtraPagesProvider.java
index f1da4a6efe0..00a195fc861 100644
--- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestExtraPagesProvider.java
+++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/templateengine/TestExtraPagesProvider.java
@@ -52,7 +52,7 @@ public class TestExtraPagesProvider implements IPagesAfterTemplateSelectionProvi
/**
* An example implementation of {@link IWizardDataPage} for test purposes.
*/
- static class MyPage extends AbstractWizardDataPage implements IWizardDataPage {
+ static class MyPage extends AbstractWizardDataPage {
String labelText, dataKey, dataValue;
public MyPage(String labelText, String dataKey, String dataValue) {

Back to the top