more Java 5 use

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1212905 13f79535-47bb-0310-9956-ffa450edef68
master
Herve Boutemy 2011-12-10 22:31:48 +00:00
parent 3d4c51b6d9
commit c61b94ee17
5 changed files with 17 additions and 30 deletions

View File

@ -171,9 +171,8 @@ public abstract class AbstractScriptedMojoDescriptorExtractor
String[] relativePaths = scanner.getIncludedFiles(); String[] relativePaths = scanner.getIncludedFiles();
for ( int i = 0; i < relativePaths.length; i++ ) for ( String relativePath : relativePaths )
{ {
String relativePath = relativePaths[i];
File scriptFile = new File( dir, relativePath ).getAbsoluteFile(); File scriptFile = new File( dir, relativePath ).getAbsoluteFile();
if ( scriptFile.isFile() && relativePath.endsWith( scriptFileExtension ) ) if ( scriptFile.isFile() && relativePath.endsWith( scriptFileExtension ) )

View File

@ -316,7 +316,7 @@ public class PluginDescriptorGenerator
extendedMojoDescriptor.getDependencyCollectionRequired() ); extendedMojoDescriptor.getDependencyCollectionRequired() );
} }
PluginUtils.element( w, "threadSafe", "" + extendedMojoDescriptor.isThreadSafe() ); PluginUtils.element( w, "threadSafe", String.valueOf( extendedMojoDescriptor.isThreadSafe() ) );
} }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------

View File

@ -91,7 +91,7 @@ public class DefaultMojoScanner
for ( String language : activeExtractorsInternal ) for ( String language : activeExtractorsInternal )
{ {
MojoDescriptorExtractor extractor = (MojoDescriptorExtractor) mojoDescriptorExtractors.get( language ); MojoDescriptorExtractor extractor = mojoDescriptorExtractors.get( language );
if ( extractor == null ) if ( extractor == null )
{ {

View File

@ -62,7 +62,7 @@ public interface MojoScanner
* <p/> * <p/>
* Only the specified extractors will be used, all others will be skipped. * Only the specified extractors will be used, all others will be skipped.
* *
* @param extractors The names of the sctive extractors. If this parameter is <code>null</code>, * @param extractors The names of the active extractors. If this parameter is <code>null</code>,
* all the scanner's extractors are considered active. Set entries that are <code>null</code> or * all the scanner's extractors are considered active. Set entries that are <code>null</code> or
* empty ("") will be ignored. * empty ("") will be ignored.
*/ */

View File

@ -31,7 +31,6 @@ import java.net.URLClassLoader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
@ -113,11 +112,10 @@ public final class PluginUtils
{ {
w.startElement( "dependencies" ); w.startElement( "dependencies" );
for ( @SuppressWarnings( "unchecked" ) @SuppressWarnings( "unchecked" )
Iterator<ComponentDependency> it = pluginDescriptor.getDependencies().iterator(); it.hasNext(); ) List<ComponentDependency> deps = pluginDescriptor.getDependencies();
for ( ComponentDependency dep : deps )
{ {
ComponentDependency dep = it.next();
w.startElement( "dependency" ); w.startElement( "dependency" );
PluginUtils.element( w, "groupId", dep.getGroupId() ); PluginUtils.element( w, "groupId", dep.getGroupId() );
@ -205,42 +203,35 @@ public final class PluginUtils
} }
catch ( DependencyResolutionRequiredException e ) catch ( DependencyResolutionRequiredException e )
{ {
throw (RuntimeException) new IllegalArgumentException().initCause( e ); throw new IllegalArgumentException( e );
} }
List<URL> urls = new ArrayList<URL>( classPathStrings.size() ); List<URL> urls = new ArrayList<URL>( classPathStrings.size() );
for ( Iterator<String> it = classPathStrings.iterator(); it.hasNext(); ) for ( String classPathString : classPathStrings )
{ {
try try
{ {
urls.add( new File( ( (String) it.next() ) ).toURL() ); urls.add( new File( classPathString ).toURL() );
} }
catch ( MalformedURLException e ) catch ( MalformedURLException e )
{ {
throw (RuntimeException) new IllegalArgumentException().initCause( e ); throw new IllegalArgumentException( e );
} }
} }
classLoader = new URLClassLoader( (URL[]) urls.toArray( new URL[urls.size()] ), classLoader = new URLClassLoader( urls.toArray( new URL[urls.size()] ), classLoader );
classLoader );
} }
Class<?> clazz = null;
try try
{ {
clazz = Class.forName( impl, false, classLoader ); Class<?> clazz = Class.forName( impl, false, classLoader );
return MavenReport.class.isAssignableFrom( clazz );
} }
catch ( ClassNotFoundException e ) catch ( ClassNotFoundException e )
{ {
return false; return false;
} }
if ( MavenReport.class.isAssignableFrom( clazz ) )
{
return true;
}
return false;
} }
/** /**
@ -447,11 +438,8 @@ public final class PluginUtils
Collections.sort( parameters, new Comparator<Parameter>() Collections.sort( parameters, new Comparator<Parameter>()
{ {
/** {@inheritDoc} */ /** {@inheritDoc} */
public int compare( Parameter arg0, Parameter arg1 ) public int compare( Parameter parameter1, Parameter parameter2 )
{ {
Parameter parameter1 = (Parameter) arg0;
Parameter parameter2 = (Parameter) arg1;
return parameter1.getName().compareToIgnoreCase( parameter2.getName() ); return parameter1.getName().compareToIgnoreCase( parameter2.getName() );
} }
} ); } );
@ -587,7 +575,7 @@ public final class PluginUtils
} }
else if ( HTML.Tag.LI.equals( t ) ) else if ( HTML.Tag.LI.equals( t ) )
{ {
Counter counter = (Counter) numbering.peek(); Counter counter = numbering.peek();
if ( counter == null ) if ( counter == null )
{ {
text( "-\t" ); text( "-\t" );