diff options
9 files changed, 30 insertions, 39 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/LocalArchetypeCatalogDialog.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/LocalArchetypeCatalogDialog.java index 13fc2d74..0301bdd2 100644 --- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/LocalArchetypeCatalogDialog.java +++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/LocalArchetypeCatalogDialog.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 @@ -226,7 +226,6 @@ public class LocalArchetypeCatalogDialog extends TitleAreaDialog { setMessage(NLS.bind(Messages.LocalArchetypeCatalogDialog_error, ex.getMessage()), IStatus.ERROR); return false; } - @SuppressWarnings("unchecked") List<Archetype> archetypes = archetypeCatalog.getArchetypes(); if(archetypes == null || archetypes.size() == 0) { setMessage(Messages.LocalArchetypeCatalogDialog_error_empty, IStatus.WARNING); diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/RemoteArchetypeCatalogDialog.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/RemoteArchetypeCatalogDialog.java index 1af21851..55f0b709 100644 --- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/RemoteArchetypeCatalogDialog.java +++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/RemoteArchetypeCatalogDialog.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 @@ -181,8 +181,7 @@ public class RemoteArchetypeCatalogDialog extends TitleAreaDialog { catalog = factory.getArchetypeCatalog(); } finally { final IStatus s = status; - @SuppressWarnings("unchecked") - final List<Archetype> archetypes = ((catalog == null) ? Collections.<Archetype> emptyList() + final List<Archetype> archetypes = ((catalog == null) ? Collections.emptyList() : catalog.getArchetypes()); Shell shell = getShell(); if(shell == null) { diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/conversion/ProjectConversionParticipantSorter.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/conversion/ProjectConversionParticipantSorter.java index 331cd803..b1e91344 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/conversion/ProjectConversionParticipantSorter.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/conversion/ProjectConversionParticipantSorter.java @@ -64,7 +64,6 @@ public class ProjectConversionParticipantSorter { private List<AbstractProjectConversionParticipant> sortedConverters; - @SuppressWarnings("unchecked") public ProjectConversionParticipantSorter(List<AbstractProjectConversionParticipant> converters) throws CycleDetectedException, DuplicateConversionParticipantException { diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java index f5ab485e..e7542735 100644 --- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java +++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.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 @@ -257,8 +257,8 @@ public class PomHyperlinkDetector implements IHyperlinkDetector { File file = XmlUtils.fileForInputLocation(openLocation, mavprj); if(file != null) { IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI()); - openXmlEditor(fileStore, openLocation.getLineNumber(), openLocation.getColumnNumber(), openLocation - .getSource().getModelId()); + openXmlEditor(fileStore, openLocation.getLineNumber(), openLocation.getColumnNumber(), + openLocation.getSource().getModelId()); } } } @@ -395,8 +395,8 @@ public class PomHyperlinkDetector implements IHyperlinkDetector { File file = XmlUtils.fileForInputLocation(location, mavprj); if(file != null) { IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI()); - openXmlEditor(fileStore, location.getLineNumber(), location.getColumnNumber(), location.getSource() - .getModelId()); + openXmlEditor(fileStore, location.getLineNumber(), location.getColumnNumber(), + location.getSource().getModelId()); } } } @@ -433,7 +433,6 @@ public class PomHyperlinkDetector implements IHyperlinkDetector { List<MarkerRegion> toRet = new ArrayList<MarkerRegion>(); IAnnotationModel model = sourceViewer.getAnnotationModel(); if(model != null) { //eg. in tests - @SuppressWarnings("unchecked") Iterator<Annotation> it = model.getAnnotationIterator(); while(it.hasNext()) { Annotation ann = it.next(); @@ -659,8 +658,7 @@ public class PomHyperlinkDetector implements IHyperlinkDetector { } } } catch(PartInitException e) { - MessageDialog.openInformation( - Display.getDefault().getActiveShell(), // + MessageDialog.openInformation(Display.getDefault().getActiveShell(), // Messages.PomHyperlinkDetector_error_title, NLS.bind(Messages.PomHyperlinkDetector_error_message, fileStore, e.toString())); diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java index 7cb8ad52..6e21a36a 100644 --- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java +++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008-2015 Sonatype, Inc. and others + * Copyright (c) 2008-2018 Sonatype, Inc. 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 @@ -56,7 +56,6 @@ public class PomQuickAssistProcessor implements IQuickAssistProcessor { public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext context) { List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); - @SuppressWarnings("unchecked") Iterator<Annotation> annotationIterator = context.getSourceViewer().getAnnotationModel().getAnnotationIterator(); while(annotationIterator.hasNext()) { Annotation annotation = annotationIterator.next(); diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomTextHover.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomTextHover.java index 9e7967ab..8348c971 100644 --- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomTextHover.java +++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomTextHover.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 @@ -169,15 +169,14 @@ public class PomTextHover implements ITextHover, ITextHoverExtension, ITextHover ISourceViewer sourceViewer = (ISourceViewer) textViewer; IAnnotationModel model = sourceViewer.getAnnotationModel(); if(model != null) { //eg. in tests - @SuppressWarnings("unchecked") Iterator<Annotation> it = model.getAnnotationIterator(); while(it.hasNext()) { Annotation ann = it.next(); if(ann instanceof MarkerAnnotation) { Position pos = sourceViewer.getAnnotationModel().getPosition(ann); if(pos.includes(offset)) { - toRet.addRegion(new PomHyperlinkDetector.MarkerRegion(pos.getOffset(), pos.getLength(), - (MarkerAnnotation) ann)); + toRet.addRegion( + new PomHyperlinkDetector.MarkerRegion(pos.getOffset(), pos.getLength(), (MarkerAnnotation) ann)); } } } 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); } } } diff --git a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java index 6454b4ba..5d8dc703 100644 --- a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.java +++ b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/AbstractMavenProjectTestCase.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 @@ -107,7 +107,6 @@ public abstract class AbstractMavenProjectTestCase extends TestCase { private String oldUserSettingsFile; - @SuppressWarnings("unchecked") protected void setUp() throws Exception { System.out.println("TEST-SETUP: " + getName()); @@ -322,7 +321,7 @@ public abstract class AbstractMavenProjectTestCase extends TestCase { /** * Import a test project into the Eclipse workspace * - * @param pomLocation - a relative location of the pom file for the project to import + * @param pomLocation - a relative location of the pom file for the project to import * @param configuration - a resolver configuration to be used to configure imported project * @return created project */ @@ -334,9 +333,9 @@ public abstract class AbstractMavenProjectTestCase extends TestCase { /** * Import a test project into the Eclipse workspace * - * @param pomLocation - a relative location of the pom file for the project to import + * @param pomLocation - a relative location of the pom file for the project to import * @param configuration - a resolver configuration to be used to configure imported project - * @param listener - listener which will get notified of the raw project creation + * @param listener - listener which will get notified of the raw project creation * @return created project */ protected IProject importProject(String pomLocation, ResolverConfiguration configuration, @@ -349,8 +348,8 @@ public abstract class AbstractMavenProjectTestCase extends TestCase { /** * Import test projects into the Eclipse workspace * - * @param basedir - a base directory for all projects to import - * @param pomNames - a relative locations of the pom files for the projects to import + * @param basedir - a base directory for all projects to import + * @param pomNames - a relative locations of the pom files for the projects to import * @param configuration - a resolver configuration to be used to configure imported projects * @return created projects */ @@ -362,8 +361,8 @@ public abstract class AbstractMavenProjectTestCase extends TestCase { /** * Import test projects into the Eclipse workspace * - * @param basedir - a base directory for all projects to import - * @param pomNames - a relative locations of the pom files for the projects to import + * @param basedir - a base directory for all projects to import + * @param pomNames - a relative locations of the pom files for the projects to import * @param configuration - a resolver configuration to be used to configure imported projects * @return created projects */ |