fixed warnings

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1402780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2012-10-27 11:15:58 +00:00
parent 390122c170
commit 9a2b77d8be
12 changed files with 26 additions and 19 deletions

View File

@ -88,8 +88,9 @@ public class MavenLifecycleParticipantTest
{ {
PlexusContainer container = getContainer(); PlexusContainer container = getContainer();
ComponentDescriptor cd = ComponentDescriptor<? extends AbstractMavenLifecycleParticipant> cd =
new ComponentDescriptor( InjectDependencyLifecycleListener.class, container.getContainerRealm() ); new ComponentDescriptor<InjectDependencyLifecycleListener>( InjectDependencyLifecycleListener.class,
container.getContainerRealm() );
cd.setRoleClass( AbstractMavenLifecycleParticipant.class ); cd.setRoleClass( AbstractMavenLifecycleParticipant.class );
container.addComponentDescriptor( cd ); container.addComponentDescriptor( cd );

View File

@ -1,11 +1,6 @@
package org.apache.maven; package org.apache.maven;
import java.io.File;
import org.apache.maven.exception.ExceptionHandler; 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; import org.codehaus.plexus.component.annotations.Requirement;
public class MavenTest public class MavenTest

View File

@ -8,7 +8,6 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Exclusion;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.annotations.Requirement;
@ -92,6 +91,7 @@ public class ProjectDependenciesResolverTest
List<String> elements = project.getCompileClasspathElements(); List<String> elements = project.getCompileClasspathElements();
assertEquals( 2, elements.size() ); assertEquals( 2, elements.size() );
@SuppressWarnings( "deprecation" )
List<Artifact> artifacts = project.getCompileArtifacts(); List<Artifact> artifacts = project.getCompileArtifacts();
assertEquals( 1, artifacts.size() ); assertEquals( 1, artifacts.size() );
assertTrue( artifacts.get( 0 ).getFile().getName().endsWith( "tools.jar" ) ); assertTrue( artifacts.get( 0 ).getFile().getName().endsWith( "tools.jar" ) );

View File

@ -32,8 +32,6 @@ public class MojoExecutionXPathContainer
{ {
private JXPathContext context; private JXPathContext context;
private MojoExecution mojoExecution;
static static
{ {
JXPathContextReferenceImpl.addNodePointerFactory( new Xpp3DomPointerFactory() ); JXPathContextReferenceImpl.addNodePointerFactory( new Xpp3DomPointerFactory() );
@ -42,7 +40,6 @@ public class MojoExecutionXPathContainer
public MojoExecutionXPathContainer( MojoExecution mojoExecution ) public MojoExecutionXPathContainer( MojoExecution mojoExecution )
throws IOException throws IOException
{ {
this.mojoExecution = mojoExecution;
context = JXPathContext.newContext( mojoExecution ); context = JXPathContext.newContext( mojoExecution );
} }

View File

@ -29,6 +29,7 @@ import java.util.Iterator;
public class ConcurrentBuildLoggerTest public class ConcurrentBuildLoggerTest
extends TestCase extends TestCase
{ {
@SuppressWarnings( "unused" )
public void testToGraph() public void testToGraph()
throws Exception throws Exception
{ {

View File

@ -58,6 +58,7 @@ public class LifecycleWeaveBuilderTest
} }
*/ */
@SuppressWarnings( "unused" )
public void testBuildProjectThreaded() public void testBuildProjectThreaded()
throws Exception throws Exception
{ {
@ -67,6 +68,7 @@ public class LifecycleWeaveBuilderTest
executor.shutdown(); executor.shutdown();
} }
@SuppressWarnings( "unused" )
public void testBuildProjectThreadedAggressive() public void testBuildProjectThreadedAggressive()
throws Exception throws Exception
{ {

View File

@ -49,6 +49,7 @@ public class DefaultLifecyclesStub
List<String> stubSiteCycle = List<String> stubSiteCycle =
Arrays.asList( PRE_SITE.getPhase(), SITE.getPhase(), POST_SITE.getPhase(), SITE_DEPLOY.getPhase() ); Arrays.asList( PRE_SITE.getPhase(), SITE.getPhase(), POST_SITE.getPhase(), SITE_DEPLOY.getPhase() );
@SuppressWarnings( "unchecked" )
Iterator<List<String>> lcs = Arrays.asList( stubDefaultCycle, stubCleanCycle, stubSiteCycle ).iterator(); Iterator<List<String>> lcs = Arrays.asList( stubDefaultCycle, stubCleanCycle, stubSiteCycle ).iterator();
Map<String, Lifecycle> lifeCycles = new HashMap<String, Lifecycle>(); Map<String, Lifecycle> lifeCycles = new HashMap<String, Lifecycle>();

View File

@ -29,7 +29,6 @@ import java.util.Properties;
import org.apache.maven.AbstractCoreMavenComponentTestCase; import org.apache.maven.AbstractCoreMavenComponentTestCase;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.DefaultMavenExecutionResult; import org.apache.maven.execution.DefaultMavenExecutionResult;
@ -315,6 +314,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( "value", value ); assertEquals( "value", value );
} }
@SuppressWarnings( "deprecation" )
private static MavenSession createSession( PlexusContainer container, ArtifactRepository repo, Properties properties ) private static MavenSession createSession( PlexusContainer container, ArtifactRepository repo, Properties properties )
throws CycleDetectedException, DuplicateProjectException throws CycleDetectedException, DuplicateProjectException
{ {

View File

@ -396,7 +396,7 @@ public class PomConstructionTest
public void testConsecutiveEmptyElements() public void testConsecutiveEmptyElements()
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "consecutive_empty_elements" ); buildPom( "consecutive_empty_elements" );
} }
public void testOrderOfGoalsFromPluginExecutionWithoutPluginManagement() public void testOrderOfGoalsFromPluginExecutionWithoutPluginManagement()
@ -1490,14 +1490,14 @@ public class PomConstructionTest
public void testDependencyScope() public void testDependencyScope()
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "dependency-scope/sub" ); buildPom( "dependency-scope/sub" );
} }
//This will fail on a validation error if incorrect //This will fail on a validation error if incorrect
public void testDependencyManagementWithInterpolation() public void testDependencyManagementWithInterpolation()
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "dependency-management-with-interpolation/sub" ); buildPom( "dependency-management-with-interpolation/sub" );
} }
public void testInterpolationWithSystemProperty() public void testInterpolationWithSystemProperty()
@ -1514,6 +1514,7 @@ public class PomConstructionTest
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "plugin-exec-inheritance/wo-merge" ); PomTestWrapper pom = buildPom( "plugin-exec-inheritance/wo-merge" );
@SuppressWarnings( "unchecked" )
List<PluginExecution> executions = List<PluginExecution> executions =
(List<PluginExecution>) pom.getValue( "build/pluginsAsMap[@name='org.apache.maven.its.plugins:maven-it-plugin-log-file']/executions" ); (List<PluginExecution>) pom.getValue( "build/pluginsAsMap[@name='org.apache.maven.its.plugins:maven-it-plugin-log-file']/executions" );
assertEquals( 1, executions.size() ); assertEquals( 1, executions.size() );
@ -1524,6 +1525,7 @@ public class PomConstructionTest
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "plugin-exec-inheritance/w-merge" ); PomTestWrapper pom = buildPom( "plugin-exec-inheritance/w-merge" );
@SuppressWarnings( "unchecked" )
List<PluginExecution> executions = List<PluginExecution> executions =
(List<PluginExecution>) pom.getValue( "build/pluginsAsMap[@name='org.apache.maven.its.plugins:maven-it-plugin-log-file']/executions" ); (List<PluginExecution>) pom.getValue( "build/pluginsAsMap[@name='org.apache.maven.its.plugins:maven-it-plugin-log-file']/executions" );
assertEquals( 1, executions.size() ); assertEquals( 1, executions.size() );
@ -1684,6 +1686,7 @@ public class PomConstructionTest
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "plugin-exec-order-and-default-exec" ); PomTestWrapper pom = buildPom( "plugin-exec-order-and-default-exec" );
@SuppressWarnings( "unchecked" )
List<PluginExecution> executions = List<PluginExecution> executions =
(List<PluginExecution>) pom.getValue( "build/plugins[@artifactId='maven-resources-plugin']/executions" ); (List<PluginExecution>) pom.getValue( "build/plugins[@artifactId='maven-resources-plugin']/executions" );
assertNotNull( executions ); assertNotNull( executions );
@ -1698,6 +1701,7 @@ public class PomConstructionTest
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "plugin-exec-order-with-lifecycle" ); PomTestWrapper pom = buildPom( "plugin-exec-order-with-lifecycle" );
@SuppressWarnings( "unchecked" )
List<Plugin> plugins = (List<Plugin>) pom.getValue( "build/plugins" ); List<Plugin> plugins = (List<Plugin>) pom.getValue( "build/plugins" );
int resourcesPlugin = -1; int resourcesPlugin = -1;
int customPlugin = -1; int customPlugin = -1;
@ -1735,7 +1739,9 @@ public class PomConstructionTest
expected.add( "maven-it-plugin-touch" ); expected.add( "maven-it-plugin-touch" );
List<String> actual = new ArrayList<String>(); List<String> actual = new ArrayList<String>();
for ( Plugin plugin : (List<Plugin>) pom.getValue( "build/plugins" ) ) @SuppressWarnings( "unchecked" )
List<Plugin> plugins = (List<Plugin>) pom.getValue( "build/plugins" );
for ( Plugin plugin : plugins )
{ {
actual.add( plugin.getArtifactId() ); actual.add( plugin.getArtifactId() );
} }
@ -1762,7 +1768,9 @@ public class PomConstructionTest
expected.add( "maven-it-plugin-touch" ); expected.add( "maven-it-plugin-touch" );
List<String> actual = new ArrayList<String>(); List<String> actual = new ArrayList<String>();
for ( Plugin plugin : (List<Plugin>) pom.getValue( "build/plugins" ) ) @SuppressWarnings( "unchecked" )
List<Plugin> plugins = (List<Plugin>) pom.getValue( "build/plugins" );
for ( Plugin plugin : plugins )
{ {
actual.add( plugin.getArtifactId() ); actual.add( plugin.getArtifactId() );
} }

View File

@ -20,7 +20,6 @@ package org.apache.maven.project;
*/ */
import java.io.File; import java.io.File;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import org.apache.maven.AbstractCoreMavenComponentTestCase; 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 // 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. // right now it's not valid to ask for artifacts unless plugins require the artifacts.
List<String> elements = project.getCompileClasspathElements(); project.getCompileClasspathElements();
} }
} }

View File

@ -29,6 +29,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.project.artifact.MavenMetadataSource; import org.apache.maven.project.artifact.MavenMetadataSource;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;
@SuppressWarnings( "deprecation" )
@Component( role = ArtifactMetadataSource.class, hint = "classpath" ) @Component( role = ArtifactMetadataSource.class, hint = "classpath" )
public class TestMetadataSource public class TestMetadataSource
extends MavenMetadataSource extends MavenMetadataSource

View File

@ -57,11 +57,13 @@ public class DefaultMavenMetadataCacheTest
throws Exception throws Exception
{ {
Artifact a1 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" ); Artifact a1 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" );
@SuppressWarnings( "deprecation" )
ArtifactRepository lr1 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() ); ArtifactRepository lr1 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() );
ArtifactRepository rr1 = repositorySystem.createDefaultRemoteRepository(); ArtifactRepository rr1 = repositorySystem.createDefaultRemoteRepository();
a1.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) ); a1.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) );
Artifact a2 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" ); Artifact a2 = repositorySystem.createArtifact( "testGroup", "testArtifact", "1.2.3", "jar" );
@SuppressWarnings( "deprecation" )
ArtifactRepository lr2 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() ); ArtifactRepository lr2 = new DelegatingLocalArtifactRepository( repositorySystem.createDefaultLocalRepository() );
ArtifactRepository rr2 = repositorySystem.createDefaultRemoteRepository(); ArtifactRepository rr2 = repositorySystem.createDefaultRemoteRepository();
a2.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) ); a2.setDependencyFilter( new ExcludesArtifactFilter( Arrays.asList( "foo" ) ) );