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/05/23 18:35:25 UTC

[GitHub] [maven-plugin-tools] michael-o commented on a diff in pull request #87: [MPLUGIN-396] Allow @Deprecated annotation without javadoc tag

michael-o commented on code in PR #87:
URL: https://github.com/apache/maven-plugin-tools/pull/87#discussion_r879760810


##########
maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/invoker.properties:
##########
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.maven.version = 3.0+
+invoker.goals.1 = clean install -DskipTests

Review Comment:
   Why skip if it is not there?



##########
maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/verify.groovy:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+expected = new File( basedir, "expected-help.txt" ).text.trim().replace( "\r", "" )
+
+log = new File( basedir, "help.log" ).text.replace( "\r", "" )

Review Comment:
   If for both, Git will do system LS and Java as well, why replace?



##########
maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java:
##########
@@ -271,6 +271,12 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor )
             {
                 MojoAnnotationContent mojoAnnotationContent = new MojoAnnotationContent();
                 populateAnnotationContent( mojoAnnotationContent, mojoAnnotationVisitor );
+
+                if ( mojoClassVisitor.getAnnotationVisitor( Deprecated.class ) != null )
+                {
+                    mojoAnnotationContent.setDeprecated( "" );

Review Comment:
   One should use `StringUtils.EMPTY` or alike to indicate that this is not a typo or bug.



##########
maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/invoker.properties:
##########
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.maven.version = 3.0+
+invoker.goals.1 = clean install -DskipTests
+invoker.goals.2 = org.apache.maven.its.plugin:help:1.0-SNAPSHOT:help
+invoker.goals.3 = --log-file help.log org.apache.maven.its.plugin:help:1.0-SNAPSHOT:help
+# --log-file option is only supported by Maven 3
+invoker.maven.version = 3.0+

Review Comment:
   Does this project work with Maven 2 as well?



##########
maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/expected-help.txt:
##########
@@ -0,0 +1,25 @@
+[INFO] help 1.0-SNAPSHOT
+  Tests generation and compilation of the help mojo.
+
+help:test
+  Deprecated. No reason given
+
+  MOJO-DESCRIPTION. Some 'quotation' marks and backslashes '\\', some important
+  javadoc
+  and an inline link to AnotherMojo.
+
+  Available parameters:
+
+    defaultParam (Default: escape\backslash)
+      This parameter uses 'quotation' marks and backslashes '\\' in its
+      description. Those characters must be escaped in Java string literals.
+
+    deprecatedParam
+      Deprecated. No reason given
+
+      This parameter is deprecated.

Review Comment:
   This is weird. I see basically the same information twice, no?



##########
maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/pom.xml:
##########
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.plugin</groupId>
+  <artifactId>help</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>maven-plugin</packaging>
+
+  <description>
+    Tests generation and compilation of the help mojo.
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>@mavenVersion@</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>3.0.1</version>

Review Comment:
   Please use 3.3.1 to stay up to date



##########
maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java:
##########
@@ -289,10 +295,15 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor )
             {
                 ParameterAnnotationContent parameterAnnotationContent =
                     new ParameterAnnotationContent( mojoFieldVisitor.getFieldName(), mojoFieldVisitor.getClassName() );
-                if ( mojoFieldVisitor.getMojoAnnotationVisitor() != null )
+
+                Map<String, MojoAnnotationVisitor> annotationVisitorMap = mojoFieldVisitor.getAnnotationVisitorMap();
+                MojoAnnotationVisitor fieldAnnotationVisitor = annotationVisitorMap.get( Parameter.class.getName() );
+
+                populateAnnotationContent( parameterAnnotationContent, fieldAnnotationVisitor );
+
+                if ( annotationVisitorMap.containsKey( Deprecated.class.getName() ) )
                 {
-                    populateAnnotationContent( parameterAnnotationContent,
-                                               mojoFieldVisitor.getMojoAnnotationVisitor() );
+                    parameterAnnotationContent.setDeprecated( "" );

Review Comment:
   same here.



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