Skip to content

Commit 620b085

Browse files
committed
Clean up code
1 parent d3e52d0 commit 620b085

File tree

37 files changed

+134
-18
lines changed

37 files changed

+134
-18
lines changed

maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public abstract class AbstractGeneratorMojo
182182
/**
183183
* {@inheritDoc}
184184
*/
185+
@Override
185186
public void execute()
186187
throws MojoExecutionException
187188
{

maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public class DescriptorGeneratorMojo
6464
/**
6565
* {@inheritDoc}
6666
*/
67+
@Override
6768
protected File getOutputDirectory()
6869
{
6970
return outputDirectory;
@@ -72,6 +73,7 @@ protected File getOutputDirectory()
7273
/**
7374
* {@inheritDoc}
7475
*/
76+
@Override
7577
protected Generator createGenerator()
7678
{
7779
return new PluginDescriptorGenerator( getLog() );
@@ -80,6 +82,7 @@ protected Generator createGenerator()
8082
/**
8183
* {@inheritDoc}
8284
*/
85+
@Override
8386
public void execute()
8487
throws MojoExecutionException
8588
{

maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class HelpGeneratorMojo
6767
/**
6868
* {@inheritDoc}
6969
*/
70+
@Override
7071
protected File getOutputDirectory()
7172
{
7273
return outputDirectory;
@@ -75,6 +76,7 @@ protected File getOutputDirectory()
7576
/**
7677
* {@inheritDoc}
7778
*/
79+
@Override
7880
protected Generator createGenerator()
7981
{
8082
return new PluginHelpGenerator().setHelpPackageName( helpPackageName ).setVelocityComponent( this.velocity );
@@ -83,6 +85,7 @@ protected Generator createGenerator()
8385
/**
8486
* {@inheritDoc}
8587
*/
88+
@Override
8689
public void execute()
8790
throws MojoExecutionException
8891
{

maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class AddPluginArtifactMetadataMojo
7272
private boolean skip;
7373

7474
/** {@inheritDoc} */
75+
@Override
7576
public void execute()
7677
throws MojoExecutionException
7778
{

maven-plugin-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/MNG6109PluginDescriptorBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public MojoDescriptor buildComponentDescriptor( PlexusConfiguration c, PluginDes
5151
for ( PlexusConfiguration d : parameterConfigurations )
5252
{
5353
String parameterName = d.getChild( "name" ).getValue();
54-
Parameter pd = (Parameter) mojoDescriptor.getParameterMap().get( parameterName );
54+
Parameter pd = mojoDescriptor.getParameterMap().get( parameterName );
5555

5656
String parameterSince = d.getChild( "since" ).getValue();
5757
pd.setSince( parameterSince );

maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.HashSet;
3232
import java.util.List;
3333
import java.util.Map;
34+
import java.util.Objects;
3435
import java.util.Set;
3536
import java.util.TreeMap;
3637
import java.util.TreeSet;
@@ -97,6 +98,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
9798
@org.codehaus.plexus.component.annotations.Requirement
9899
private ArchiverManager archiverManager;
99100

101+
@Override
100102
public List<MojoDescriptor> execute( PluginToolsRequest request )
101103
throws ExtractionException, InvalidPluginDescriptorException
102104
{
@@ -137,7 +139,7 @@ private Map<String, JavaClass> scanJavadoc( PluginToolsRequest request,
137139

138140
for ( MojoAnnotatedClass mojoAnnotatedClass : mojoAnnotatedClasses )
139141
{
140-
if ( StringUtils.equals( mojoAnnotatedClass.getArtifact().getArtifactId(),
142+
if ( Objects.equals( mojoAnnotatedClass.getArtifact().getArtifactId(),
141143
request.getProject().getArtifact().getArtifactId() ) )
142144
{
143145
continue;
@@ -413,12 +415,11 @@ protected Map<String, JavaClass> discoverClasses( final PluginToolsRequest reque
413415
return discoverClasses( request.getEncoding(), request.getProject() );
414416
}
415417

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

421-
for ( String source : (List<String>) project.getCompileSourceRoots() )
422+
for ( String source : project.getCompileSourceRoots() )
422423
{
423424
sources.add( new File( source ) );
424425
}
@@ -725,11 +726,10 @@ protected MavenProject getFromProjectReferences( Artifact artifact, MavenProject
725726
{
726727
return null;
727728
}
728-
@SuppressWarnings( "unchecked" ) Collection<MavenProject> mavenProjects =
729-
project.getProjectReferences().values();
729+
Collection<MavenProject> mavenProjects = project.getProjectReferences().values();
730730
for ( MavenProject mavenProject : mavenProjects )
731731
{
732-
if ( StringUtils.equals( mavenProject.getId(), artifact.getId() ) )
732+
if ( Objects.equals( mavenProject.getId(), artifact.getId() ) )
733733
{
734734
return mavenProject;
735735
}

maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/AnnotatedField.java

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public String toString()
5454
return sb.toString();
5555
}
5656

57+
@Override
5758
public int compareTo( AnnotatedField annotatedField )
5859
{
5960
return getFieldName().compareTo( annotatedField.getFieldName() );

maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/ComponentAnnotationContent.java

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public ComponentAnnotationContent( String fieldName, String role, String hint )
4747
this.hint = hint;
4848
}
4949

50+
@Override
5051
public Class<?> role()
5152
{
5253
// not used
@@ -63,6 +64,7 @@ public String getRoleClassName()
6364
return roleClassName;
6465
}
6566

67+
@Override
6668
public String hint()
6769
{
6870
return hint == null ? "" : hint;
@@ -73,6 +75,7 @@ public void hint( String hint )
7375
this.hint = hint;
7476
}
7577

78+
@Override
7679
public Class<? extends Annotation> annotationType()
7780
{
7881
return null;

maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/ExecuteAnnotationContent.java

+4
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,19 @@ public class ExecuteAnnotationContent
3737

3838
private LifecyclePhase phase;
3939

40+
@Override
4041
public LifecyclePhase phase()
4142
{
4243
return this.phase;
4344
}
4445

46+
@Override
4547
public String goal()
4648
{
4749
return this.goal;
4850
}
4951

52+
@Override
5053
public String lifecycle()
5154
{
5255
return this.lifecycle;
@@ -69,6 +72,7 @@ public void lifecycle( String lifecycle )
6972
}
7073

7174

75+
@Override
7276
public Class<? extends Annotation> annotationType()
7377
{
7478
return null;

maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/MojoAnnotationContent.java

+15
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ public class MojoAnnotationContent
6262

6363
private boolean threadSafe = false;
6464

65+
@Override
6566
public Class<? extends Annotation> annotationType()
6667
{
6768
return null;
6869
}
6970

71+
@Override
7072
public LifecyclePhase defaultPhase()
7173
{
7274
return defaultPhase;
@@ -77,6 +79,7 @@ public void defaultPhase( String phase )
7779
this.defaultPhase = LifecyclePhase.valueOf( phase );
7880
}
7981

82+
@Override
8083
public ResolutionScope requiresDependencyResolution()
8184
{
8285
return requiresDependencyResolution;
@@ -87,6 +90,7 @@ public void requiresDependencyResolution( String requiresDependencyResolution )
8790
this.requiresDependencyResolution = ResolutionScope.valueOf( requiresDependencyResolution );
8891
}
8992

93+
@Override
9094
public ResolutionScope requiresDependencyCollection()
9195
{
9296
return requiresDependencyCollection;
@@ -97,6 +101,7 @@ public void requiresDependencyCollection( String requiresDependencyCollection )
97101
this.requiresDependencyCollection = ResolutionScope.valueOf( requiresDependencyCollection );
98102
}
99103

104+
@Override
100105
public InstantiationStrategy instantiationStrategy()
101106
{
102107
return instantiationStrategy;
@@ -107,6 +112,7 @@ public void instantiationStrategy( String instantiationStrategy )
107112
this.instantiationStrategy = InstantiationStrategy.valueOf( instantiationStrategy );
108113
}
109114

115+
@Override
110116
public String executionStrategy()
111117
{
112118
return executionStrategy;
@@ -117,6 +123,7 @@ public void executionStrategy( String executionStrategy )
117123
this.executionStrategy = executionStrategy;
118124
}
119125

126+
@Override
120127
public boolean requiresProject()
121128
{
122129
return requiresProject;
@@ -127,6 +134,7 @@ public void requiresProject( boolean requiresProject )
127134
this.requiresProject = requiresProject;
128135
}
129136

137+
@Override
130138
public boolean requiresReports()
131139
{
132140
return requiresReports;
@@ -137,6 +145,7 @@ public void requiresReports( boolean requiresReports )
137145
this.requiresReports = requiresReports;
138146
}
139147

148+
@Override
140149
public boolean aggregator()
141150
{
142151
return aggregator;
@@ -147,6 +156,7 @@ public void aggregator( boolean aggregator )
147156
this.aggregator = aggregator;
148157
}
149158

159+
@Override
150160
public boolean requiresDirectInvocation()
151161
{
152162
return requiresDirectInvocation;
@@ -157,6 +167,7 @@ public void requiresDirectInvocation( boolean requiresDirectInvocation )
157167
this.requiresDirectInvocation = requiresDirectInvocation;
158168
}
159169

170+
@Override
160171
public boolean requiresOnline()
161172
{
162173
return requiresOnline;
@@ -167,6 +178,7 @@ public void requiresOnline( boolean requiresOnline )
167178
this.requiresOnline = requiresOnline;
168179
}
169180

181+
@Override
170182
public boolean inheritByDefault()
171183
{
172184
return inheritByDefault;
@@ -177,6 +189,7 @@ public void inheritByDefault( boolean inheritByDefault )
177189
this.inheritByDefault = inheritByDefault;
178190
}
179191

192+
@Override
180193
public String configurator()
181194
{
182195
return configurator;
@@ -187,6 +200,7 @@ public void configurator( String configurator )
187200
this.configurator = configurator;
188201
}
189202

203+
@Override
190204
public boolean threadSafe()
191205
{
192206
return threadSafe;
@@ -197,6 +211,7 @@ public void threadSafe( boolean threadSafe )
197211
this.threadSafe = threadSafe;
198212
}
199213

214+
@Override
200215
public String name()
201216
{
202217
return this.name;

maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/ParameterAnnotationContent.java

+7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public ParameterAnnotationContent( String fieldName, String alias, String proper
6363
this.readonly = readonly;
6464
}
6565

66+
@Override
6667
public String name()
6768
{
6869
return name;
@@ -73,6 +74,7 @@ public void name( String name )
7374
this.name = name;
7475
}
7576

77+
@Override
7678
public String alias()
7779
{
7880
return alias;
@@ -83,6 +85,7 @@ public void alias( String alias )
8385
this.alias = alias;
8486
}
8587

88+
@Override
8689
public String property()
8790
{
8891
return property;
@@ -93,6 +96,7 @@ public void property( String property )
9396
this.property = property;
9497
}
9598

99+
@Override
96100
public String defaultValue()
97101
{
98102
return defaultValue;
@@ -103,6 +107,7 @@ public void defaultValue( String defaultValue )
103107
this.defaultValue = defaultValue;
104108
}
105109

110+
@Override
106111
public boolean required()
107112
{
108113
return required;
@@ -113,6 +118,7 @@ public void required( boolean required )
113118
this.required = required;
114119
}
115120

121+
@Override
116122
public boolean readonly()
117123
{
118124
return readonly;
@@ -123,6 +129,7 @@ public void readonly( boolean readonly )
123129
this.readonly = readonly;
124130
}
125131

132+
@Override
126133
public Class<? extends Annotation> annotationType()
127134
{
128135
return null;

maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public class DefaultMojoAnnotationsScanner
6666

6767
private Reflector reflector = new Reflector();
6868

69+
@Override
6970
public Map<String, MojoAnnotatedClass> scan( MojoAnnotationsScannerRequest request )
7071
throws ExtractionException
7172
{
@@ -311,7 +312,7 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor )
311312
for ( Map.Entry<String, Object> entry : annotationVisitor.getAnnotationValues().entrySet() )
312313
{
313314
String methodName = entry.getKey();
314-
if ( StringUtils.equals( "role", methodName ) )
315+
if ( "role".equals( methodName ) )
315316
{
316317
Type type = (Type) entry.getValue();
317318
componentAnnotationContent.setRoleClassName( type.getClassName() );

0 commit comments

Comments
 (0)