Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
rfscholte committed Apr 22, 2021
1 parent d3e52d0 commit 620b085
Show file tree
Hide file tree
Showing 37 changed files with 134 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public abstract class AbstractGeneratorMojo
/**
* {@inheritDoc}
*/
@Override
public void execute()
throws MojoExecutionException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class DescriptorGeneratorMojo
/**
* {@inheritDoc}
*/
@Override
protected File getOutputDirectory()
{
return outputDirectory;
Expand All @@ -72,6 +73,7 @@ protected File getOutputDirectory()
/**
* {@inheritDoc}
*/
@Override
protected Generator createGenerator()
{
return new PluginDescriptorGenerator( getLog() );
Expand All @@ -80,6 +82,7 @@ protected Generator createGenerator()
/**
* {@inheritDoc}
*/
@Override
public void execute()
throws MojoExecutionException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class HelpGeneratorMojo
/**
* {@inheritDoc}
*/
@Override
protected File getOutputDirectory()
{
return outputDirectory;
Expand All @@ -75,6 +76,7 @@ protected File getOutputDirectory()
/**
* {@inheritDoc}
*/
@Override
protected Generator createGenerator()
{
return new PluginHelpGenerator().setHelpPackageName( helpPackageName ).setVelocityComponent( this.velocity );
Expand All @@ -83,6 +85,7 @@ protected Generator createGenerator()
/**
* {@inheritDoc}
*/
@Override
public void execute()
throws MojoExecutionException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class AddPluginArtifactMetadataMojo
private boolean skip;

/** {@inheritDoc} */
@Override
public void execute()
throws MojoExecutionException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public MojoDescriptor buildComponentDescriptor( PlexusConfiguration c, PluginDes
for ( PlexusConfiguration d : parameterConfigurations )
{
String parameterName = d.getChild( "name" ).getValue();
Parameter pd = (Parameter) mojoDescriptor.getParameterMap().get( parameterName );
Parameter pd = mojoDescriptor.getParameterMap().get( parameterName );

String parameterSince = d.getChild( "since" ).getValue();
pd.setSince( parameterSince );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
Expand Down Expand Up @@ -97,6 +98,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
@org.codehaus.plexus.component.annotations.Requirement
private ArchiverManager archiverManager;

@Override
public List<MojoDescriptor> execute( PluginToolsRequest request )
throws ExtractionException, InvalidPluginDescriptorException
{
Expand Down Expand Up @@ -137,7 +139,7 @@ private Map<String, JavaClass> scanJavadoc( PluginToolsRequest request,

for ( MojoAnnotatedClass mojoAnnotatedClass : mojoAnnotatedClasses )
{
if ( StringUtils.equals( mojoAnnotatedClass.getArtifact().getArtifactId(),
if ( Objects.equals( mojoAnnotatedClass.getArtifact().getArtifactId(),
request.getProject().getArtifact().getArtifactId() ) )
{
continue;
Expand Down Expand Up @@ -413,12 +415,11 @@ protected Map<String, JavaClass> discoverClasses( final PluginToolsRequest reque
return discoverClasses( request.getEncoding(), request.getProject() );
}

@SuppressWarnings( "unchecked" )
protected Map<String, JavaClass> discoverClasses( final String encoding, final MavenProject project )
{
List<File> sources = new ArrayList<>();

for ( String source : (List<String>) project.getCompileSourceRoots() )
for ( String source : project.getCompileSourceRoots() )
{
sources.add( new File( source ) );
}
Expand Down Expand Up @@ -725,11 +726,10 @@ protected MavenProject getFromProjectReferences( Artifact artifact, MavenProject
{
return null;
}
@SuppressWarnings( "unchecked" ) Collection<MavenProject> mavenProjects =
project.getProjectReferences().values();
Collection<MavenProject> mavenProjects = project.getProjectReferences().values();
for ( MavenProject mavenProject : mavenProjects )
{
if ( StringUtils.equals( mavenProject.getId(), artifact.getId() ) )
if ( Objects.equals( mavenProject.getId(), artifact.getId() ) )
{
return mavenProject;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public String toString()
return sb.toString();
}

@Override
public int compareTo( AnnotatedField annotatedField )
{
return getFieldName().compareTo( annotatedField.getFieldName() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public ComponentAnnotationContent( String fieldName, String role, String hint )
this.hint = hint;
}

@Override
public Class<?> role()
{
// not used
Expand All @@ -63,6 +64,7 @@ public String getRoleClassName()
return roleClassName;
}

@Override
public String hint()
{
return hint == null ? "" : hint;
Expand All @@ -73,6 +75,7 @@ public void hint( String hint )
this.hint = hint;
}

@Override
public Class<? extends Annotation> annotationType()
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ public class ExecuteAnnotationContent

private LifecyclePhase phase;

@Override
public LifecyclePhase phase()
{
return this.phase;
}

@Override
public String goal()
{
return this.goal;
}

@Override
public String lifecycle()
{
return this.lifecycle;
Expand All @@ -69,6 +72,7 @@ public void lifecycle( String lifecycle )
}


@Override
public Class<? extends Annotation> annotationType()
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ public class MojoAnnotationContent

private boolean threadSafe = false;

@Override
public Class<? extends Annotation> annotationType()
{
return null;
}

@Override
public LifecyclePhase defaultPhase()
{
return defaultPhase;
Expand All @@ -77,6 +79,7 @@ public void defaultPhase( String phase )
this.defaultPhase = LifecyclePhase.valueOf( phase );
}

@Override
public ResolutionScope requiresDependencyResolution()
{
return requiresDependencyResolution;
Expand All @@ -87,6 +90,7 @@ public void requiresDependencyResolution( String requiresDependencyResolution )
this.requiresDependencyResolution = ResolutionScope.valueOf( requiresDependencyResolution );
}

@Override
public ResolutionScope requiresDependencyCollection()
{
return requiresDependencyCollection;
Expand All @@ -97,6 +101,7 @@ public void requiresDependencyCollection( String requiresDependencyCollection )
this.requiresDependencyCollection = ResolutionScope.valueOf( requiresDependencyCollection );
}

@Override
public InstantiationStrategy instantiationStrategy()
{
return instantiationStrategy;
Expand All @@ -107,6 +112,7 @@ public void instantiationStrategy( String instantiationStrategy )
this.instantiationStrategy = InstantiationStrategy.valueOf( instantiationStrategy );
}

@Override
public String executionStrategy()
{
return executionStrategy;
Expand All @@ -117,6 +123,7 @@ public void executionStrategy( String executionStrategy )
this.executionStrategy = executionStrategy;
}

@Override
public boolean requiresProject()
{
return requiresProject;
Expand All @@ -127,6 +134,7 @@ public void requiresProject( boolean requiresProject )
this.requiresProject = requiresProject;
}

@Override
public boolean requiresReports()
{
return requiresReports;
Expand All @@ -137,6 +145,7 @@ public void requiresReports( boolean requiresReports )
this.requiresReports = requiresReports;
}

@Override
public boolean aggregator()
{
return aggregator;
Expand All @@ -147,6 +156,7 @@ public void aggregator( boolean aggregator )
this.aggregator = aggregator;
}

@Override
public boolean requiresDirectInvocation()
{
return requiresDirectInvocation;
Expand All @@ -157,6 +167,7 @@ public void requiresDirectInvocation( boolean requiresDirectInvocation )
this.requiresDirectInvocation = requiresDirectInvocation;
}

@Override
public boolean requiresOnline()
{
return requiresOnline;
Expand All @@ -167,6 +178,7 @@ public void requiresOnline( boolean requiresOnline )
this.requiresOnline = requiresOnline;
}

@Override
public boolean inheritByDefault()
{
return inheritByDefault;
Expand All @@ -177,6 +189,7 @@ public void inheritByDefault( boolean inheritByDefault )
this.inheritByDefault = inheritByDefault;
}

@Override
public String configurator()
{
return configurator;
Expand All @@ -187,6 +200,7 @@ public void configurator( String configurator )
this.configurator = configurator;
}

@Override
public boolean threadSafe()
{
return threadSafe;
Expand All @@ -197,6 +211,7 @@ public void threadSafe( boolean threadSafe )
this.threadSafe = threadSafe;
}

@Override
public String name()
{
return this.name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public ParameterAnnotationContent( String fieldName, String alias, String proper
this.readonly = readonly;
}

@Override
public String name()
{
return name;
Expand All @@ -73,6 +74,7 @@ public void name( String name )
this.name = name;
}

@Override
public String alias()
{
return alias;
Expand All @@ -83,6 +85,7 @@ public void alias( String alias )
this.alias = alias;
}

@Override
public String property()
{
return property;
Expand All @@ -93,6 +96,7 @@ public void property( String property )
this.property = property;
}

@Override
public String defaultValue()
{
return defaultValue;
Expand All @@ -103,6 +107,7 @@ public void defaultValue( String defaultValue )
this.defaultValue = defaultValue;
}

@Override
public boolean required()
{
return required;
Expand All @@ -113,6 +118,7 @@ public void required( boolean required )
this.required = required;
}

@Override
public boolean readonly()
{
return readonly;
Expand All @@ -123,6 +129,7 @@ public void readonly( boolean readonly )
this.readonly = readonly;
}

@Override
public Class<? extends Annotation> annotationType()
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class DefaultMojoAnnotationsScanner

private Reflector reflector = new Reflector();

@Override
public Map<String, MojoAnnotatedClass> scan( MojoAnnotationsScannerRequest request )
throws ExtractionException
{
Expand Down Expand Up @@ -311,7 +312,7 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor )
for ( Map.Entry<String, Object> entry : annotationVisitor.getAnnotationValues().entrySet() )
{
String methodName = entry.getKey();
if ( StringUtils.equals( "role", methodName ) )
if ( "role".equals( methodName ) )
{
Type type = (Type) entry.getValue();
componentAnnotationContent.setRoleClassName( type.getClassName() );
Expand Down
Loading

0 comments on commit 620b085

Please sign in to comment.