belingueres commented on a change in pull request #285:
URL: https://github.com/apache/maven/pull/285#discussion_r830517208



##########
File path: 
maven-core/src/main/java/org/apache/maven/plugin/internal/ValidatingConfigurationListener.java
##########
@@ -94,4 +111,53 @@ private void notify( String fieldName, Object value )
         }
     }
 
+    private void warnDeprecated( String fieldName, Object value )
+    {
+        Parameter parameter = mojoDescriptor.getParameterMap().get( fieldName 
);
+        String deprecated = parameter.getDeprecated();
+        if ( deprecated != null && !deprecated.isEmpty() )
+        {
+            if ( !toString( value ).equals( toString( 
parameter.getDefaultValue() ) ) )
+            {
+                StringBuilder sb = new StringBuilder( "  Parameter '" );
+                sb.append( fieldName ).append( '\'' );
+                if ( parameter.getExpression() != null )
+                {
+                    String userProperty = parameter.getExpression().replace( 
"${", "'" ).replace( '}', '\'' );
+                    sb.append( " (User Property " ).append( userProperty 
).append( ")" );
+                }
+                sb.append( " is deprecated. " ).append( deprecated );
+
+                logger.warn( MessageUtils.buffer().warning( sb.toString() 
).toString() );
+            }
+        }
+    }
+
+    /**
+     * Creates a human-friendly string representation of the specified object.
+     *
+     * @param obj The object to create a string representation for, may be 
<code>null</code>.
+     * @return The string representation, never <code>null</code>.
+     */
+    private String toString( Object obj )

Review comment:
       I have no problem delegating to `DebugConfigurationListener` instead of 
duplicating code in `ValidatingConfigurationListener`, but in that case I 
suggest also to "un-deprecate" `DebugConfigurationListener` because it is just 
confusing if that class should continue to be used or not.




-- 
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-unsubscr...@maven.apache.org

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


Reply via email to