From 1ceea70d9e1471d8f48353f24fef4a8408851c4e Mon Sep 17 00:00:00 2001 From: Stephan Herrmann Date: Thu, 20 Jun 2024 17:36:23 +0200 Subject: [PATCH] remove unnecessary casts --- .../tests/metadata/repository/SPIMetadataRepositoryTest.java | 4 ++-- .../internal/p2/ui/discovery/util/ControlListViewer.java | 2 +- .../p2/importexport/internal/wizard/ExportWizard.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java index 151014d526..28ebb321d5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java @@ -875,8 +875,8 @@ public void testSPIEquals() throws ProvisionException, URISyntaxException { assertEquals(unit.getTouchpointData().size(), 1); assertEquals(((IRequiredCapability) unit.getRequirements().iterator().next()).getNamespace(), spiRequiredCapability.getNamespace()); assertEquals(((IRequiredCapability) unit.getRequirements().iterator().next()).getName(), spiRequiredCapability.getName()); - assertEquals(((IRequiredCapability) unit.getRequirements().iterator().next()).getMin(), spiRequiredCapability.getMin()); - assertEquals(((IRequiredCapability) unit.getRequirements().iterator().next()).getMax(), spiRequiredCapability.getMax()); + assertEquals(unit.getRequirements().iterator().next().getMin(), spiRequiredCapability.getMin()); + assertEquals(unit.getRequirements().iterator().next().getMax(), spiRequiredCapability.getMax()); assertEquals(unit.getProvidedCapabilities().iterator().next(), spiProvidedCapability); assertEquals(unit.getTouchpointData().iterator().next(), spiTouchpointData); assertEquals(unit.getTouchpointType(), spiTouchpointType); diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java index f20f9fd9f9..a7e3c85242 100644 --- a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java +++ b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java @@ -200,7 +200,7 @@ public void add(Object[] elements) { // Update with the new elements to prevent flash for (Control element : existingChildren) { - ((ControlListItem) element).dispose(); + element.dispose(); } for (int i = 0; i < infos.length; i++) { diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java index 07e3d9654f..34ab886599 100755 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java @@ -55,7 +55,7 @@ public void init(IWorkbench workbench, IStructuredSelection selection) { @Override public boolean performFinish() { - File file = new File(((ExportPage) mainPage).getDestinationValue()); + File file = new File(mainPage.getDestinationValue()); if (file.exists()) { if (!MessageDialog.openConfirm(this.getShell(), Messages.ExportWizard_ConfirmDialogTitle, NLS.bind(Messages.ExportWizard_OverwriteConfirm, file.getAbsolutePath())))