mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Bug 540373: Cleanup warnings in tests
- Remove redundant super-interfaces - Remove redundant null checks - Remove redundant instanceof checks Change-Id: I3e8adba818b58f8ae5b43682ace74812db5b9bb4
This commit is contained in:
parent
f869a3f247
commit
3859b78b71
6 changed files with 19 additions and 29 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue