From 9a2b77d8bef0a50c6bdbe117e125744618fb8b1d Mon Sep 17 00:00:00 2001 From: Herve Boutemy Date: Sat, 27 Oct 2012 11:15:58 +0000 Subject: [PATCH] fixed warnings git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1402780 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/MavenLifecycleParticipantTest.java | 5 +++-- .../test/java/org/apache/maven/MavenTest.java | 5 ----- .../maven/ProjectDependenciesResolverTest.java | 2 +- .../lifecycle/MojoExecutionXPathContainer.java | 3 --- .../internal/ConcurrentBuildLoggerTest.java | 1 + .../internal/LifecycleWeaveBuilderTest.java | 2 ++ .../internal/stub/DefaultLifecyclesStub.java | 1 + ...PluginParameterExpressionEvaluatorTest.java | 2 +- .../maven/project/PomConstructionTest.java | 18 +++++++++++++----- .../maven/project/ProjectBuilderTest.java | 3 +-- .../maven/project/TestMetadataSource.java | 1 + .../DefaultMavenMetadataCacheTest.java | 2 ++ 12 files changed, 26 insertions(+), 19 deletions(-) diff --git a/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java b/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java index b220304cff..558d917d17 100644 --- a/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java +++ b/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java @@ -88,8 +88,9 @@ public class MavenLifecycleParticipantTest { PlexusContainer container = getContainer(); - ComponentDescriptor cd = - new ComponentDescriptor( InjectDependencyLifecycleListener.class, container.getContainerRealm() ); + ComponentDescriptor cd = + new ComponentDescriptor( InjectDependencyLifecycleListener.class, + container.getContainerRealm() ); cd.setRoleClass( AbstractMavenLifecycleParticipant.class ); container.addComponentDescriptor( cd ); diff --git a/maven-core/src/test/java/org/apache/maven/MavenTest.java b/maven-core/src/test/java/org/apache/maven/MavenTest.java index 5cfdada00d..6e6b5cdb51 100644 --- a/maven-core/src/test/java/org/apache/maven/MavenTest.java +++ b/maven-core/src/test/java/org/apache/maven/MavenTest.java @@ -1,11 +1,6 @@ package org.apache.maven; -import java.io.File; - import org.apache.maven.exception.ExceptionHandler; -import org.apache.maven.exception.ExceptionSummary; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenExecutionResult; import org.codehaus.plexus.component.annotations.Requirement; public class MavenTest diff --git a/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java b/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java index dbbfb99136..9d38102c73 100644 --- a/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java +++ b/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java @@ -8,7 +8,6 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Exclusion; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.component.annotations.Requirement; @@ -92,6 +91,7 @@ public class ProjectDependenciesResolverTest List elements = project.getCompileClasspathElements(); assertEquals( 2, elements.size() ); + @SuppressWarnings( "deprecation" ) List artifacts = project.getCompileArtifacts(); assertEquals( 1, artifacts.size() ); assertTrue( artifacts.get( 0 ).getFile().getName().endsWith( "tools.jar" ) ); diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/MojoExecutionXPathContainer.java b/maven-core/src/test/java/org/apache/maven/lifecycle/MojoExecutionXPathContainer.java index 48c0a445f1..6244cc919e 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/MojoExecutionXPathContainer.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/MojoExecutionXPathContainer.java @@ -32,8 +32,6 @@ public class MojoExecutionXPathContainer { private JXPathContext context; - private MojoExecution mojoExecution; - static { JXPathContextReferenceImpl.addNodePointerFactory( new Xpp3DomPointerFactory() ); @@ -42,7 +40,6 @@ public class MojoExecutionXPathContainer public MojoExecutionXPathContainer( MojoExecution mojoExecution ) throws IOException { - this.mojoExecution = mojoExecution; context = JXPathContext.newContext( mojoExecution ); } diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/ConcurrentBuildLoggerTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/ConcurrentBuildLoggerTest.java index f89c282b5d..115c0d38fa 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/ConcurrentBuildLoggerTest.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/ConcurrentBuildLoggerTest.java @@ -29,6 +29,7 @@ import java.util.Iterator; public class ConcurrentBuildLoggerTest extends TestCase { + @SuppressWarnings( "unused" ) public void testToGraph() throws Exception { diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java index a44267b960..5c5e7e8a81 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java @@ -58,6 +58,7 @@ public class LifecycleWeaveBuilderTest } */ + @SuppressWarnings( "unused" ) public void testBuildProjectThreaded() throws Exception { @@ -67,6 +68,7 @@ public class LifecycleWeaveBuilderTest executor.shutdown(); } + @SuppressWarnings( "unused" ) public void testBuildProjectThreadedAggressive() throws Exception { diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/DefaultLifecyclesStub.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/DefaultLifecyclesStub.java index 48b308fc22..5bf53ea493 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/DefaultLifecyclesStub.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/DefaultLifecyclesStub.java @@ -49,6 +49,7 @@ public class DefaultLifecyclesStub List stubSiteCycle = Arrays.asList( PRE_SITE.getPhase(), SITE.getPhase(), POST_SITE.getPhase(), SITE_DEPLOY.getPhase() ); + @SuppressWarnings( "unchecked" ) Iterator> lcs = Arrays.asList( stubDefaultCycle, stubCleanCycle, stubSiteCycle ).iterator(); Map lifeCycles = new HashMap(); diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java index af98474941..5f6744c945 100644 --- a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java +++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java @@ -29,7 +29,6 @@ import java.util.Properties; import org.apache.maven.AbstractCoreMavenComponentTestCase; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.DefaultMavenExecutionResult; @@ -315,6 +314,7 @@ public class PluginParameterExpressionEvaluatorTest assertEquals( "value", value ); } + @SuppressWarnings( "deprecation" ) private static MavenSession createSession( PlexusContainer container, ArtifactRepository repo, Properties properties ) throws CycleDetectedException, DuplicateProjectException { diff --git a/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java b/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java index 574efbc2c9..83123cfa99 100644 --- a/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java +++ b/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java @@ -396,7 +396,7 @@ public class PomConstructionTest public void testConsecutiveEmptyElements() throws Exception { - PomTestWrapper pom = buildPom( "consecutive_empty_elements" ); + buildPom( "consecutive_empty_elements" ); } public void testOrderOfGoalsFromPluginExecutionWithoutPluginManagement() @@ -1490,14 +1490,14 @@ public class PomConstructionTest public void testDependencyScope() throws Exception { - PomTestWrapper pom = buildPom( "dependency-scope/sub" ); + buildPom( "dependency-scope/sub" ); } //This will fail on a validation error if incorrect public void testDependencyManagementWithInterpolation() throws Exception { - PomTestWrapper pom = buildPom( "dependency-management-with-interpolation/sub" ); + buildPom( "dependency-management-with-interpolation/sub" ); } public void testInterpolationWithSystemProperty() @@ -1514,6 +1514,7 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPom( "plugin-exec-inheritance/wo-merge" ); + @SuppressWarnings( "unchecked" ) List executions = (List) pom.getValue( "build/pluginsAsMap[@name='org.apache.maven.its.plugins:maven-it-plugin-log-file']/executions" ); assertEquals( 1, executions.size() ); @@ -1524,6 +1525,7 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPom( "plugin-exec-inheritance/w-merge" ); + @SuppressWarnings( "unchecked" ) List executions = (List) pom.getValue( "build/pluginsAsMap[@name='org.apache.maven.its.plugins:maven-it-plugin-log-file']/executions" ); assertEquals( 1, executions.size() ); @@ -1684,6 +1686,7 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPom( "plugin-exec-order-and-default-exec" ); + @SuppressWarnings( "unchecked" ) List executions = (List) pom.getValue( "build/plugins[@artifactId='maven-resources-plugin']/executions" ); assertNotNull( executions ); @@ -1698,6 +1701,7 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPom( "plugin-exec-order-with-lifecycle" ); + @SuppressWarnings( "unchecked" ) List plugins = (List) pom.getValue( "build/plugins" ); int resourcesPlugin = -1; int customPlugin = -1; @@ -1735,7 +1739,9 @@ public class PomConstructionTest expected.add( "maven-it-plugin-touch" ); List actual = new ArrayList(); - for ( Plugin plugin : (List) pom.getValue( "build/plugins" ) ) + @SuppressWarnings( "unchecked" ) + List plugins = (List) pom.getValue( "build/plugins" ); + for ( Plugin plugin : plugins ) { actual.add( plugin.getArtifactId() ); } @@ -1762,7 +1768,9 @@ public class PomConstructionTest expected.add( "maven-it-plugin-touch" ); List actual = new ArrayList(); - for ( Plugin plugin : (List) pom.getValue( "build/plugins" ) ) + @SuppressWarnings( "unchecked" ) + List plugins = (List) pom.getValue( "build/plugins" ); + for ( Plugin plugin : plugins ) { actual.add( plugin.getArtifactId() ); } diff --git a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java index 9a47053333..d618d57c92 100644 --- a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java +++ b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java @@ -20,7 +20,6 @@ package org.apache.maven.project; */ import java.io.File; -import java.util.List; import java.util.Properties; import org.apache.maven.AbstractCoreMavenComponentTestCase; @@ -48,6 +47,6 @@ public class ProjectBuilderTest // Here we will actually not have any artifacts because the ProjectDependenciesResolver is not involved here. So // right now it's not valid to ask for artifacts unless plugins require the artifacts. - List elements = project.getCompileClasspathElements(); + project.getCompileClasspathElements(); } } diff --git a/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java b/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java index 67b6ca4167..9a7a72c90b 100644 --- a/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java +++ b/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java @@ -29,6 +29,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.project.artifact.MavenMetadataSource; import org.codehaus.plexus.component.annotations.Component; +@SuppressWarnings( "deprecation" ) @Component( role = ArtifactMetadataSource.class, hint = "classpath" ) public class TestMetadataSource extends MavenMetadataSource diff --git a/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java b/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java index 8433e43a67..ba378030e2 100644 --- a/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java +++ b/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java @@ -57,11 +57,13 @@ public class DefaultMavenMetadataCacheTest throws Exception { Artifact a1 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" ); + @SuppressWarnings( "deprecation" ) ArtifactRepository lr1 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() ); ArtifactRepository rr1 = repositorySystem.createDefaultRemoteRepository(); a1.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) ); Artifact a2 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" ); + @SuppressWarnings( "deprecation" ) ArtifactRepository lr2 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() ); ArtifactRepository rr2 = repositorySystem.createDefaultRemoteRepository(); a2.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) );