Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-11-20 09:25:27 +0000
committerMickael Istria2019-11-20 12:43:22 +0000
commit6658b12b7f0ab09b23aa5f84c308e7da43542bed (patch)
tree72582d351f492d9652420525811c5a09c38419f0
parent7b7ec9e502f5523dba4e3c47f23f602f4fccb5dc (diff)
downloadm2e-core-6658b12b7f0ab09b23aa5f84c308e7da43542bed.tar.gz
m2e-core-6658b12b7f0ab09b23aa5f84c308e7da43542bed.tar.xz
m2e-core-6658b12b7f0ab09b23aa5f84c308e7da43542bed.zip
Less SuppressWarnings.
Change-Id: I51b44f71c8aa5e39ce43794c4a14cb2d7281a42a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java3
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/views/nodes/IndexedArtifactFileNode.java3
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java2
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java4
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchExtensionsSupport.java15
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java3
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java3
7 files changed, 14 insertions, 19 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java
index 2b0b5fb6..ba65bfb2 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/SelectionUtil.java
@@ -139,13 +139,12 @@ public class SelectionUtil {
/**
* Checks if the object belongs to a given type and returns it or a suitable adapter.
*/
- @SuppressWarnings("unchecked")
public static <T> T getType(Object element, Class<T> type) {
if(element == null) {
return null;
}
if(type.isInstance(element)) {
- return (T) element;
+ return type.cast(element);
}
if(element instanceof IAdaptable) {
T adapter = ((IAdaptable) element).getAdapter(type);
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/views/nodes/IndexedArtifactFileNode.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/views/nodes/IndexedArtifactFileNode.java
index 25ff86f2..0c3e94c2 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/views/nodes/IndexedArtifactFileNode.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/views/nodes/IndexedArtifactFileNode.java
@@ -76,10 +76,9 @@ public class IndexedArtifactFileNode extends PlatformObject implements IMavenRep
return false;
}
- @SuppressWarnings("rawtypes")
public static class AdapterFactory implements IAdapterFactory {
- private static final Class[] ADAPTERS = new Class[] {ArtifactKey.class, IndexedArtifactFile.class};
+ private static final Class<?>[] ADAPTERS = new Class[] {ArtifactKey.class, IndexedArtifactFile.class};
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if(adaptableObject instanceof IndexedArtifactFileNode) {
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java
index 61a02567..4385d9bd 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java
@@ -185,7 +185,7 @@ public class ListEditorComposite<T> extends Composite {
@SuppressWarnings("unchecked")
public List<T> getSelection() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ IStructuredSelection selection = viewer.getStructuredSelection();
return selection == null ? Collections.emptyList() : selection.toList();
}
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java
index 771d5915..02bd5f44 100644
--- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java
+++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java
@@ -38,11 +38,11 @@ import org.eclipse.m2e.jdt.MavenJdtPlugin;
* @author Eugene Kuleshov
* @author Miles Parker (Split out into JavaUiElementsAdapterFactory)
*/
-@SuppressWarnings({"rawtypes"})
public class JavaElementsAdapterFactory implements IAdapterFactory {
private static final Logger log = LoggerFactory.getLogger(JavaElementsAdapterFactory.class);
- private static final Class[] ADAPTER_LIST = new Class[] {ArtifactKey.class, IPath.class, IMavenProjectFacade.class};
+ private static final Class<?>[] ADAPTER_LIST = new Class[] {ArtifactKey.class, IPath.class,
+ IMavenProjectFacade.class};
public Class<?>[] getAdapterList() {
return ADAPTER_LIST;
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchExtensionsSupport.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchExtensionsSupport.java
index 011cc0ad..2e2ab65a 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchExtensionsSupport.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchExtensionsSupport.java
@@ -48,25 +48,24 @@ public class MavenLaunchExtensionsSupport {
if(launch.getSourceLocator() instanceof MavenSourceLocator) {
final MavenSourceLocator sourceLocator = (MavenSourceLocator) launch.getSourceLocator();
for(IMavenLaunchParticipant participant : participants) {
- List<ISourceLookupParticipant> sourceLookupParticipants = participant.getSourceLookupParticipants(
- configuration, launch, monitor);
+ List<ISourceLookupParticipant> sourceLookupParticipants = participant.getSourceLookupParticipants(configuration,
+ launch, monitor);
if(sourceLookupParticipants != null && !sourceLookupParticipants.isEmpty()) {
- sourceLocator.addParticipants(sourceLookupParticipants
- .toArray(new ISourceLookupParticipant[sourceLookupParticipants.size()]));
+ sourceLocator.addParticipants(
+ sourceLookupParticipants.toArray(new ISourceLookupParticipant[sourceLookupParticipants.size()]));
}
}
sourceLocator.addParticipants(new ISourceLookupParticipant[] {new JavaSourceLookupParticipant()});
} else {
- log.warn(NLS.bind(Messages.MavenLaynchDelegate_unsupported_source_locator, launch.getSourceLocator().getClass()
- .getCanonicalName()));
+ log.warn(NLS.bind(Messages.MavenLaynchDelegate_unsupported_source_locator,
+ launch.getSourceLocator().getClass().getCanonicalName()));
}
}
public static MavenLaunchExtensionsSupport create(ILaunchConfiguration configuration, ILaunch launch)
throws CoreException {
- @SuppressWarnings("unchecked")
Set<String> disabledExtensions = configuration.getAttribute(MavenLaunchConstants.ATTR_DISABLED_EXTENSIONS,
- Collections.EMPTY_SET);
+ Collections.emptySet());
List<IMavenLaunchParticipant> participants = new ArrayList<IMavenLaunchParticipant>();
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java
index 7fdfc115..adbde792 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchExtensionsTab.java
@@ -138,11 +138,10 @@ public class MavenLaunchExtensionsTab extends AbstractLaunchConfigurationTab {
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
}
- @SuppressWarnings("unchecked")
public void initializeFrom(ILaunchConfiguration configuration) {
try {
disabledParticipants = new HashSet<String>(
- configuration.getAttribute(MavenLaunchConstants.ATTR_DISABLED_EXTENSIONS, Collections.EMPTY_SET));
+ configuration.getAttribute(MavenLaunchConstants.ATTR_DISABLED_EXTENSIONS, Collections.emptySet()));
} catch(CoreException ex) {
disabledParticipants = new HashSet<String>();
}
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java
index 06cfcdeb..8cd6af4d 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java
@@ -475,8 +475,7 @@ public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implement
this.propsTable.removeAll();
- @SuppressWarnings("unchecked")
- List<String> properties = configuration.getAttribute(ATTR_PROPERTIES, Collections.EMPTY_LIST);
+ List<String> properties = configuration.getAttribute(ATTR_PROPERTIES, Collections.emptyList());
for(String property : properties) {
int n = property.indexOf('=');
String name = property;

Back to the top