diff options
author | Alexander Kurtakov | 2017-09-10 07:45:18 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-09-10 07:45:18 +0000 |
commit | 7e9b9c916ed778b044e9b4dde20e5dc94db37956 (patch) | |
tree | 836de86cad27622a803ac563c9dec9848a30311e | |
parent | ce8888e5faa2bd53fc1219b76e178bd436bd1b65 (diff) | |
download | eclipse.platform.ua-7e9b9c916ed778b044e9b4dde20e5dc94db37956.tar.gz eclipse.platform.ua-7e9b9c916ed778b044e9b4dde20e5dc94db37956.tar.xz eclipse.platform.ua-7e9b9c916ed778b044e9b4dde20e5dc94db37956.zip |
Bug 522095 - Fix info warnings in platform.uaI20170910-2000I20170910-1055I20170910-0800
* Use Class.cast instead of cast operator.
* Silence unlikely-arg-type warning in tests.
Change-Id: Icf3798bc9534a2bd376d91891a00cb5848c4017f
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
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); } |