You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/10/29 08:31:00 UTC

[jira] [Commented] (MPLUGIN-438) Parameter description should be taken from annotated item

    [ https://issues.apache.org/jira/browse/MPLUGIN-438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17626021#comment-17626021 ] 

ASF GitHub Bot commented on MPLUGIN-438:
----------------------------------------

kwin commented on code in PR #168:
URL: https://github.com/apache/maven-plugin-tools/pull/168#discussion_r1008660842


##########
maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java:
##########
@@ -463,6 +472,51 @@ private Map<String, JavaAnnotatedElement> extractParameterAnnotations( JavaClass
                 rawParams.put( field.getName(), field );
             }
 
+            return rawParams;
+        }
+        catch ( NoClassDefFoundError e )
+        {
+            getLogger().warn( "Failed extracting parameters from " + javaClass );
+            throw e;
+        }
+    }
+
+    /**
+     * extract methods that are parameters.
+     *
+     * @param javaClass not null
+     * @return map with Mojo parameters names as keys
+     */
+    private Map<String, JavaAnnotatedElement> extractMethodsAnnotations( JavaClass javaClass,
+                                                                        Map<String, JavaClass> javaClassesMap )
+    {
+        try
+        {
+            Map<String, JavaAnnotatedElement> rawParams = new TreeMap<>();
+
+            // we have to add the parent fields first, so that they will be overwritten by the local fields if

Review Comment:
   methods instead of fields



##########
maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/datamodel/ParameterAnnotationContent.java:
##########
@@ -48,20 +48,24 @@
 
     private String className;
 
+    private boolean methodSource;
+
     private final List<String> typeParameters;
 
-    public ParameterAnnotationContent( String fieldName, String className, List<String> typeParameters )
+    public ParameterAnnotationContent( String fieldName, String className, List<String> typeParameters,
+                                       boolean methodSource )
     {
         super( fieldName );
         this.className = className;
         this.typeParameters = typeParameters;
+        this.methodSource = methodSource;
     }
 
     public ParameterAnnotationContent( String fieldName, String alias, String property, String defaultValue,
                                        boolean required, boolean readonly, String className,
-                                       List<String> typeParameters )
+                                       List<String> typeParameters, boolean methodSource )

Review Comment:
   maybe `annotationOnMethod` or `methodAnnotation`?





> Parameter description should be taken from annotated item
> ---------------------------------------------------------
>
>                 Key: MPLUGIN-438
>                 URL: https://issues.apache.org/jira/browse/MPLUGIN-438
>             Project: Maven Plugin Tools
>          Issue Type: Bug
>            Reporter: Slawomir Jaranowski
>            Assignee: Slawomir Jaranowski
>            Priority: Major
>             Fix For: 3.7.0
>
>
> When we have declared both - field  and setter method for field - parameter description should be taken from item with @Parameter annotation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)