code simplification

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1592265 13f79535-47bb-0310-9956-ffa450edef68
master
Herve Boutemy 2014-05-03 19:05:48 +00:00
parent 63a11167e0
commit daf8877b3d
3 changed files with 7 additions and 10 deletions

View File

@ -186,9 +186,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
private boolean isMojoAnnnotatedClassCandidate( MojoAnnotatedClass mojoAnnotatedClass )
{
return mojoAnnotatedClass != null
&& !( mojoAnnotatedClass.getComponents().isEmpty() && mojoAnnotatedClass.getParameters().isEmpty()
&& mojoAnnotatedClass.getExecute() == null && mojoAnnotatedClass.getMojo() == null );
return mojoAnnotatedClass != null && mojoAnnotatedClass.hasAnnotations();
}
protected Map<String, JavaClass> discoverClassesFromSourcesJar( Artifact artifact, PluginToolsRequest request,

View File

@ -212,7 +212,7 @@ public class DefaultMojoAnnotationsScanner
if ( mojoAnnotatedClass != null ) // see MPLUGIN-206 we can have intermediate classes without annotations
{
if ( getLogger().isDebugEnabled() && hasMojoAnnotations( mojoAnnotatedClass ) )
if ( getLogger().isDebugEnabled() && mojoAnnotatedClass.hasAnnotations() )
{
getLogger().debug( "found MojoAnnotatedClass:" + mojoAnnotatedClass.getClassName() + ":"
+ mojoAnnotatedClass );
@ -222,12 +222,6 @@ public class DefaultMojoAnnotationsScanner
}
}
private boolean hasMojoAnnotations( MojoAnnotatedClass mojoAnnotatedClass )
{
return !( mojoAnnotatedClass.getComponents().isEmpty() && mojoAnnotatedClass.getParameters().isEmpty()
&& mojoAnnotatedClass.getExecute() == null && mojoAnnotatedClass.getMojo() == null );
}
protected void populateAnnotationContent( Object content, MojoAnnotationVisitor mojoAnnotationVisitor )
throws ReflectorException
{

View File

@ -146,6 +146,11 @@ public class MojoAnnotatedClass
this.artifact = artifact;
}
public boolean hasAnnotations()
{
return !( getComponents().isEmpty() && getParameters().isEmpty() && execute == null && mojo == null );
}
@Override
public String toString()
{