diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 7f5b9dc6e7..47cd70947d 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -78,11 +78,15 @@ On both scenarios, disabling the cache takes precedence over setting a cache loc ### API Changes -* A new CLI switch, `-no-cache`, disables incremental analysis and the related suggestion. This overrides the -`-cache` option. The corresponding Ant task parameter is `noCache`. +* A new CLI switch, `-no-cache`, disables incremental analysis and the related suggestion. This overrides the + `-cache` option. The corresponding Ant task parameter is `noCache`. -* The static method `PMDParameters.transformParametersIntoConfiguration(PMDParameters)` is now deprecated, - for removal in 7.0.0. The new instance method `PMDParameters.toConfiguration()` replaces it. +* The static method `PMDParameters.transformParametersIntoConfiguration(PMDParameters)` is now deprecated, + for removal in 7.0.0. The new instance method `PMDParameters.toConfiguration()` replaces it. + +* The method `ASTConstructorDeclaration.getParameters()` has been deprecated in favor of the new method + `getFormalParameters()`. This method is available for both `ASTConstructorDeclaration` and + `ASTMethodDeclaration`. ### External Contributions diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTConstructorDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTConstructorDeclaration.java index f9955ce061..5fbdc3a9d1 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTConstructorDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTConstructorDeclaration.java @@ -21,14 +21,6 @@ public class ASTConstructorDeclaration extends AbstractJavaAccessNode implements super(p, id); } - public ASTFormalParameters getParameters() { - return (ASTFormalParameters) (jjtGetChild(0) instanceof ASTFormalParameters ? jjtGetChild(0) : jjtGetChild(1)); - } - - public int getParameterCount() { - return getParameters().getParameterCount(); - } - /** * Accept the visitor. * */ @@ -62,7 +54,16 @@ public class ASTConstructorDeclaration extends AbstractJavaAccessNode implements return signature; } - @Override + @Deprecated // to be removed with PMD 7.0.0 - use getFormalParameters() instead + public ASTFormalParameters getParameters() { + return getFormalParameters(); + } + + public int getParameterCount() { + return getFormalParameters().getParameterCount(); + } + + //@Override // enable this with PMD 7.0.0 - see interface ASTMethodOrConstructorDeclaration public ASTFormalParameters getFormalParameters() { return getFirstChildOfType(ASTFormalParameters.class); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTMethodDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTMethodDeclaration.java index 76aee3ba6e..815d6b0749 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTMethodDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTMethodDeclaration.java @@ -170,7 +170,7 @@ public class ASTMethodDeclaration extends AbstractJavaAccessNode implements DFAG } - @Override + //@Override // enable this with PMD 7.0.0 - see interface ASTMethodOrConstructorDeclaration public ASTFormalParameters getFormalParameters() { return getFirstChildOfType(ASTMethodDeclarator.class).getFirstChildOfType(ASTFormalParameters.class); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTMethodOrConstructorDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTMethodOrConstructorDeclaration.java index 88a05cf237..094ebd2f53 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTMethodOrConstructorDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTMethodOrConstructorDeclaration.java @@ -19,10 +19,12 @@ public interface ASTMethodOrConstructorDeclaration extends @Override JavaOperationSignature getSignature(); - - /** - * Returns the formal parameters node of this method or constructor. - */ - ASTFormalParameters getFormalParameters(); + // + // Enable this with PMD 7.0.0 + // + ///** + // * Returns the formal parameters node of this method or constructor. + // */ + //ASTFormalParameters getFormalParameters(); }