Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-03-16 03:15:27 -0400
committerAlexander Kurtakov2018-03-16 10:53:17 -0400
commit7f24b625fecc009bb47d24bf877d55ad868914b0 (patch)
treea13363d6265756b5fc4221b5cb2bc77b14bbf7b5 /org.eclipse.m2e.jdt
parent2929cbe556350a7728d81c63b429caa6b79b2829 (diff)
downloadm2e-core-7f24b625fecc009bb47d24bf877d55ad868914b0.tar.gz
m2e-core-7f24b625fecc009bb47d24bf877d55ad868914b0.tar.xz
m2e-core-7f24b625fecc009bb47d24bf877d55ad868914b0.zip
Remove unneeded suppress warnings.
And some generification where spotted. Change-Id: Ia21fc7aff3b0ffe9de561cd541f02e8dda1f4b8e Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.m2e.jdt')
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java3
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java16
2 files changed, 9 insertions, 10 deletions
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
index 1c1b2367..751ba66e 100644
--- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
+++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2013 Sonatype, Inc.
+ * Copyright (c) 2008-2018 Sonatype, Inc.
* 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
@@ -726,7 +726,6 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
return new Path(relative.replace('\\', '/')); //$NON-NLS-1$ //$NON-NLS-2$
}
- @SuppressWarnings("restriction")
public void configureClasspath(IMavenProjectFacade facade, IClasspathDescriptor classpath, IProgressMonitor monitor)
throws CoreException {
ModuleSupport.configureClasspath(facade, classpath, monitor);
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 94a0bf40..771d5915 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
+ * Copyright (c) 2008-2018 Sonatype, Inc.
* 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
@@ -38,24 +38,24 @@ import org.eclipse.m2e.jdt.MavenJdtPlugin;
* @author Eugene Kuleshov
* @author Miles Parker (Split out into JavaUiElementsAdapterFactory)
*/
-@SuppressWarnings({"restriction", "rawtypes"})
+@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};
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return ADAPTER_LIST;
}
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if(adapterType == ArtifactKey.class) {
if(adaptableObject instanceof IPackageFragmentRoot) {
IPackageFragmentRoot fragment = (IPackageFragmentRoot) adaptableObject;
IProject project = fragment.getJavaProject().getProject();
if(project.isAccessible() && fragment.isArchive()) {
try {
- return getBuildPathManager().findArtifact(project, fragment.getPath());
+ return adapterType.cast(getBuildPathManager().findArtifact(project, fragment.getPath()));
} catch(CoreException ex) {
log.error("Can't find artifact for " + fragment, ex);
return null;
@@ -63,7 +63,7 @@ public class JavaElementsAdapterFactory implements IAdapterFactory {
}
} else if(adaptableObject instanceof IJavaProject) {
- return ((IJavaProject) adaptableObject).getProject().getAdapter(ArtifactKey.class);
+ return adapterType.cast(((IJavaProject) adaptableObject).getProject().getAdapter(ArtifactKey.class));
}
@@ -71,7 +71,7 @@ public class JavaElementsAdapterFactory implements IAdapterFactory {
if(adaptableObject instanceof IJavaElement) {
IResource resource = ((IJavaElement) adaptableObject).getResource();
if(resource != null) {
- return resource.getLocation();
+ return adapterType.cast(resource.getLocation());
}
}
@@ -80,7 +80,7 @@ public class JavaElementsAdapterFactory implements IAdapterFactory {
IProject project = ((IJavaElement) adaptableObject).getJavaProject().getProject();
IMavenProjectFacade projectFacade = getProjectFacade(project);
if(projectFacade != null) {
- return projectFacade;
+ return adapterType.cast(projectFacade);
}
}
}

Back to the top