Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java3
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java7
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java3
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java3
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java3
5 files changed, 8 insertions, 11 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java
index c4e798adc..82d507cd5 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,7 @@ public class UAElementTest {
private UAElement child4;
private UAElement grandchild1;
+ @SuppressWarnings("unlikely-arg-type")
@Test
public void testSimpleUAElement() {
UAElement element = new UAElement("name1");
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java
index c84fecdf2..34a269b28 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -105,13 +105,12 @@ public class Category implements IWorkbenchAdapter, IPluginContribution,
elements.add(element);
}
- @SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class)
- return (T) this;
+ return adapter.cast(this);
else if (adapter == IConfigurationElement.class)
- return (T) configurationElement;
+ return adapter.cast(configurationElement);
else
return null;
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
index ae86a7698..5010876fb 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
@@ -110,10 +110,9 @@ public class CheatSheetCollectionElement extends WorkbenchAdapter implements IPl
* associated with this object. Returns <code>null</code> if
* no such object can be found.
*/
- @SuppressWarnings("unchecked")
public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class) {
- return (T) this;
+ return adapter.cast(this);
}
return Platform.getAdapterManager().getAdapter(this, adapter);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
index 7d621f896..e08fc9cbb 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
@@ -54,11 +54,10 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I
* associated with this object. Returns <code>null</code> if
* no such object can be found.
*/
- @SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class) {
- return (T) this;
+ return adapter.cast(this);
}
return Platform.getAdapterManager().getAdapter(this, adapter);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java
index 626dcb740..ba945bd51 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java
@@ -47,11 +47,10 @@ public class CheatSheetItemExtensionElement extends WorkbenchAdapter implements
* associated with this object. Returns <code>null</code> if
* no such object can be found.
*/
- @SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class) {
- return (T) this;
+ return adapter.cast(this);
}
return Platform.getAdapterManager().getAdapter(this, adapter);
}

Back to the top