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/26 11:26:12 UTC

[GitHub] [maven-plugin-tools] kwin opened a new pull request, #159: [MPLUGIN-427] Expose generics information of parameter types in report

kwin opened a new pull request, #159:
URL: https://github.com/apache/maven-plugin-tools/pull/159

   and help mojo


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


[GitHub] [maven-plugin-tools] kwin commented on pull request #159: [MPLUGIN-427] Expose generics information of parameter types in report

Posted by GitBox <gi...@apache.org>.
kwin commented on PR #159:
URL: https://github.com/apache/maven-plugin-tools/pull/159#issuecomment-1292139763

   @gnodet Good catch, will make sure to emit the simple type there as well.


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


[GitHub] [maven-plugin-tools] slawekjaranowski commented on pull request #159: [MPLUGIN-427] Expose generics information of parameter types in report

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on PR #159:
URL: https://github.com/apache/maven-plugin-tools/pull/159#issuecomment-1292137750

   @kwin 
   
   One issue what I see: in `target/classes/META-INF/maven/plugin.xml` is:
   
   ```
     <mojos>
       <mojo>
           <parameter>
             <name>reactorProjects</name>
             <type>java.util.List</type>
             <required>true</required>
             <editable>false</editable>
             <description></description>
           </parameter>
   ....
   
         <configuration>
        ...
        <reactorProjects implementation="java.util.List&lt;org.apache.maven.project.MavenProject&gt;" default-value="${reactorProjects}"/>
      ...
         </configuration>
   ...
   ```
   
   should we have `parameter type` in `configuration`


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


[GitHub] [maven-plugin-tools] kwin commented on a diff in pull request #159: [MPLUGIN-427] Expose generics information of parameter types in report

Posted by GitBox <gi...@apache.org>.
kwin commented on code in PR #159:
URL: https://github.com/apache/maven-plugin-tools/pull/159#discussion_r1005619793


##########
maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java:
##########
@@ -76,4 +80,48 @@ void scanDeprecatedMojoAnnotatins() throws ExtractionException, IOException
             .isEqualTo( "property.anotherNotDeprecated" );
     }
 
+    @Test
+    void scanParametersWithGenerics() throws ExtractionException, IOException
+    {
+        File directoryToScan = new File( ParametersWithGenericsMojo.class.getResource( "" ).getFile() );
+
+        scanner.enableLogging( mock( Logger.class ) );
+        Map<String, MojoAnnotatedClass> result = scanner.scanDirectory(
+            directoryToScan, Collections.singletonList( "ParametersWithGenericsMojo**.class" ), null, false );
+
+        assertThat( result ).hasSize( 2 ); // mojo and nested class
+
+        MojoAnnotatedClass annotatedClass = result.get( ParametersWithGenericsMojo.class.getName() );
+        assertThat( annotatedClass.getClassName() ).isEqualTo( ParametersWithGenericsMojo.class.getName() );
+
+        ParameterAnnotationContent parameter = annotatedClass.getParameters().get( "string" );
+        assertNotNull( parameter );
+        assertEquals( "java.lang.String", parameter.getClassName() );
+        assertThat( parameter.getTypeParameters() ).isEmpty();
+
+        parameter = annotatedClass.getParameters().get( "stringBooleanMap" );
+        assertNotNull( parameter );
+        assertEquals( "java.util.Map", parameter.getClassName() );
+        assertThat( parameter.getTypeParameters() ).contains( "java.lang.String", "java.lang.Boolean" );

Review Comment:
   Done in https://github.com/apache/maven-plugin-tools/pull/159/commits/4816ac73c9f622a7122c56ee6b478c39b6bc7211. I am so used to using Hamcrest, where `contains` has other semantics.



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


[GitHub] [maven-plugin-tools] slawekjaranowski commented on a diff in pull request #159: [MPLUGIN-427] Expose generics information of parameter types in report

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #159:
URL: https://github.com/apache/maven-plugin-tools/pull/159#discussion_r1005581941


##########
maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java:
##########
@@ -76,4 +80,48 @@ void scanDeprecatedMojoAnnotatins() throws ExtractionException, IOException
             .isEqualTo( "property.anotherNotDeprecated" );
     }
 
+    @Test
+    void scanParametersWithGenerics() throws ExtractionException, IOException
+    {
+        File directoryToScan = new File( ParametersWithGenericsMojo.class.getResource( "" ).getFile() );
+
+        scanner.enableLogging( mock( Logger.class ) );
+        Map<String, MojoAnnotatedClass> result = scanner.scanDirectory(
+            directoryToScan, Collections.singletonList( "ParametersWithGenericsMojo**.class" ), null, false );
+
+        assertThat( result ).hasSize( 2 ); // mojo and nested class
+
+        MojoAnnotatedClass annotatedClass = result.get( ParametersWithGenericsMojo.class.getName() );
+        assertThat( annotatedClass.getClassName() ).isEqualTo( ParametersWithGenericsMojo.class.getName() );
+
+        ParameterAnnotationContent parameter = annotatedClass.getParameters().get( "string" );
+        assertNotNull( parameter );
+        assertEquals( "java.lang.String", parameter.getClassName() );
+        assertThat( parameter.getTypeParameters() ).isEmpty();
+
+        parameter = annotatedClass.getParameters().get( "stringBooleanMap" );
+        assertNotNull( parameter );
+        assertEquals( "java.util.Map", parameter.getClassName() );
+        assertThat( parameter.getTypeParameters() ).contains( "java.lang.String", "java.lang.Boolean" );

Review Comment:
   Maybe:
   ```
   assertThat(..). containsExactly( ... )
   ```
   



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


[GitHub] [maven-plugin-tools] kwin merged pull request #159: [MPLUGIN-427] Expose generics information of parameter types in report

Posted by GitBox <gi...@apache.org>.
kwin merged PR #159:
URL: https://github.com/apache/maven-plugin-tools/pull/159


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