You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/10/29 08:30:38 UTC

[GitHub] [maven-plugin-tools] kwin commented on a diff in pull request #168: [MPLUGIN-438] Parameter description should be taken from annotated item

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`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org