Skip to content

Commit 6f2754b

Browse files
remove unnecessary casts (#1438)
1 parent e639885 commit 6f2754b

File tree

24 files changed

+36
-39
lines changed

24 files changed

+36
-39
lines changed

ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection) {
546546
}
547547
}
548548
if (resource != null) {
549-
IPath location = ((IFile) resource).getLocation();
549+
IPath location = resource.getLocation();
550550
if (location != null) {
551551
List<ILaunchConfiguration> list = collectConfigurations(location);
552552
return list.toArray(new ILaunchConfiguration[list.size()]);

ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntEditorPreferencePage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,8 @@ protected void controlChanged(Widget widget) {
689689

690690
private void updateControlsForProblemReporting(boolean reportProblems) {
691691
for (int i = fComboBoxes.size() - 1; i >= 0; i--) {
692-
((Control) fComboBoxes.get(i)).setEnabled(reportProblems);
693-
((Control) fProblemLabels.get(i)).setEnabled(reportProblems);
692+
fComboBoxes.get(i).setEnabled(reportProblems);
693+
fProblemLabels.get(i).setEnabled(reportProblems);
694694
}
695695
fSeverityLabel.setEnabled(reportProblems);
696696
fBuildFilesToIgnoreProblems.setEnabled(reportProblems);

ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/RunTargetAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,17 @@ public void update() {
100100
AntElementNode selection = getSelectedElement();
101101
boolean enabled = false;
102102
if (selection instanceof AntTargetNode) {
103-
if (!((AntTargetNode) selection).isErrorNode()) {
103+
if (!selection.isErrorNode()) {
104104
setToolTipText(AntViewActionMessages.RunTargetAction_4);
105105
enabled = true;
106106
}
107107
} else if (selection instanceof AntProjectNode) {
108-
if (!((AntProjectNode) selection).isErrorNode()) {
108+
if (!selection.isErrorNode()) {
109109
enabled = true;
110110
setToolTipText(AntViewActionMessages.RunTargetAction_3);
111111
}
112112
} else if (selection instanceof AntTaskNode) {
113-
if (!((AntTaskNode) selection).isErrorNode()) {
113+
if (!selection.isErrorNode()) {
114114
enabled = true;
115115
setToolTipText(AntViewActionMessages.RunTargetAction_0);
116116
}

ant/org.eclipse.ant.ui/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.ant.ui; singleton:=true
5-
Bundle-Version: 3.9.400.qualifier
5+
Bundle-Version: 3.9.500.qualifier
66
Bundle-Activator: org.eclipse.ant.internal.ui.AntUIPlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin

debug/org.eclipse.debug.tests/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.debug.tests;singleton:=true
5-
Bundle-Version: 3.14.200.qualifier
5+
Bundle-Version: 3.14.300.qualifier
66
Bundle-Localization: plugin
77
Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
88
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ContentTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void testLabelUpdatesCompletedOutOfSequence1() throws Exception {
172172

173173
// Complete the second set of children updates
174174
for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
175-
((ILabelUpdate)model.fCapturedUpdates.get(i)).done();
175+
model.fCapturedUpdates.get(i).done();
176176
}
177177

178178
// Then complete the first set.
@@ -229,7 +229,7 @@ public void testLabelUpdatesCompletedOutOfSequence2() throws Exception {
229229

230230
// Complete the second set of children updates
231231
for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
232-
((ILabelUpdate)model.fCapturedUpdates.get(i)).done();
232+
model.fCapturedUpdates.get(i).done();
233233
}
234234

235235
// Then complete the first set.
@@ -281,7 +281,7 @@ public void _x_testChildrenUpdatesCompletedOutOfSequence() throws Exception {
281281

282282
// Complete the second set of children updates
283283
for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
284-
((IChildrenUpdate)model.fCapturedUpdates.get(i)).done();
284+
model.fCapturedUpdates.get(i).done();
285285
}
286286

287287
// Then complete the first set.

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerBrowser.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser;
2323
import org.eclipse.jface.window.Window;
2424
import org.eclipse.swt.widgets.Shell;
25-
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
2625
import org.eclipse.ui.model.WorkbenchContentProvider;
2726
import org.eclipse.ui.model.WorkbenchLabelProvider;
2827

@@ -38,7 +37,7 @@ public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector
3837
FolderSourceContainerDialog dialog = new FolderSourceContainerDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
3938

4039
if (dialog.open() == Window.OK) {
41-
Object[] selection= ((ElementTreeSelectionDialog)dialog).getResult();
40+
Object[] selection= dialog.getResult();
4241
ArrayList<ISourceContainer> containers = new ArrayList<>();
4342
for (Object f : selection) {
4443
if (f instanceof IFolder) {
@@ -63,7 +62,7 @@ public ISourceContainer[] editSourceContainers(Shell shell, ISourceLookupDirecto
6362
dialog.setInitialSelection(container.getContainer());
6463
if (dialog.open() == Window.OK) {
6564
container.dispose();
66-
Object[] selection= ((ElementTreeSelectionDialog)dialog).getResult();
65+
Object[] selection= dialog.getResult();
6766
ArrayList<ISourceContainer> list = new ArrayList<>();
6867
for (Object f : selection) {
6968
if (f instanceof IFolder) {

resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/SortBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private void deleteResource(IResource resource) throws CoreException {
222222
}
223223
folder.delete(true, null);
224224
} else if (type == IResource.FILE) {
225-
((IFile) resource).delete(true, null);
225+
resource.delete(true, null);
226226
} else {
227227
throw new ResourceException(IResourceStatus.RESOURCE_WRONG_TYPE, null, "Wrong resource type", null);
228228
}

resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/CopyTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import static org.junit.Assert.assertThrows;
2424
import static org.junit.Assert.assertTrue;
2525

26-
import org.eclipse.core.resources.IContainer;
2726
import org.eclipse.core.resources.IFile;
2827
import org.eclipse.core.resources.IFolder;
2928
import org.eclipse.core.resources.IProject;
@@ -111,11 +110,11 @@ public void testCopyResource() throws Throwable {
111110
() -> folder.copy(destinationFolder.getFullPath(), false, null));
112111
assertThat(exception.getStatus().getChildren()).hasSize(2);
113112
assertTrue(destinationFolder.exists());
114-
assertTrue(((IContainer) destinationFolder).getFile(IPath.fromOSString(file.getName())).exists());
115-
assertFalse(((IContainer) destinationFolder).getFolder(IPath.fromOSString(subfolder.getName())).exists());
116-
assertFalse(((IContainer) destinationFolder).getFile(IPath.fromOSString(anotherFile.getName())).exists());
113+
assertTrue(destinationFolder.getFile(IPath.fromOSString(file.getName())).exists());
114+
assertFalse(destinationFolder.getFolder(IPath.fromOSString(subfolder.getName())).exists());
115+
assertFalse(destinationFolder.getFile(IPath.fromOSString(anotherFile.getName())).exists());
117116
/* assert properties were properly copied */
118-
IResource target = ((IContainer) destinationFolder).getFile(IPath.fromOSString(file.getName()));
117+
IResource target = destinationFolder.getFile(IPath.fromOSString(file.getName()));
119118
for (int i = 0; i < NUMBER_OF_PROPERTIES; i++) {
120119
String persistentValue = target.getPersistentProperty(propNames[i]);
121120
Object sessionValue = target.getSessionProperty(propNames[i]);

resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/MoveTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import org.eclipse.core.internal.resources.Resource;
3737
import org.eclipse.core.internal.resources.ResourceInfo;
3838
import org.eclipse.core.internal.resources.Workspace;
39-
import org.eclipse.core.resources.IContainer;
4039
import org.eclipse.core.resources.IFile;
4140
import org.eclipse.core.resources.IFolder;
4241
import org.eclipse.core.resources.IProject;
@@ -464,7 +463,7 @@ public void testMoveResource() throws Exception {
464463
assertTrue(folder.exists());
465464
// FIXME: should #move be a best effort operation?
466465
// its ok for the root to be moved but ensure the destination child wasn't moved
467-
IResource destChild = ((IContainer) folderDestination).getFile(IPath.fromOSString(anotherFile.getName()));
466+
IResource destChild = folderDestination.getFile(IPath.fromOSString(anotherFile.getName()));
468467
assertFalse(folderDestination.exists());
469468
assertFalse(destChild.exists());
470469
// cleanup and delete the destination

0 commit comments

Comments
 (0)