Less SuppressWarnings.

Change-Id: I51b44f71c8aa5e39ce43794c4a14cb2d7281a42a
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
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 2b0b5fb..ba65bfb 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 @@
   /**
    * 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 25ff86f..0c3e94c 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 @@
     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 61a0256..4385d9b 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 @@
 
   @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 771d591..02bd5f4 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 @@
  * @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 011cc0a..2e2ab65 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 @@
     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 7fdfc11..adbde79 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 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 06cfcde..8cd6af4 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 @@
 
       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;