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



##########
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:
       can be static

##########
File path: 
maven-core/src/main/java/org/apache/maven/plugin/internal/ValidatingConfigurationListener.java
##########
@@ -68,21 +75,31 @@
 
     public void notifyFieldChangeUsingSetter( String fieldName, Object value, 
Object target )
     {
-        delegate.notifyFieldChangeUsingSetter( fieldName, value, target );
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "  (s) " + fieldName + " = " + toString( value ) );
+        }
 
         if ( mojo == target )
         {
             notify( fieldName, value );
+
+            warnDeprecated( fieldName, value );

Review comment:
       move to notify method - will be in one place

##########
File path: 
maven-core/src/main/java/org/apache/maven/plugin/internal/ValidatingConfigurationListener.java
##########
@@ -68,21 +75,31 @@
 
     public void notifyFieldChangeUsingSetter( String fieldName, Object value, 
Object target )
     {
-        delegate.notifyFieldChangeUsingSetter( fieldName, value, target );
+        if ( logger.isDebugEnabled() )
+        {
+            logger.debug( "  (s) " + fieldName + " = " + toString( value ) );
+        }

Review comment:
       move to notify method - will be in one place




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