[java] Remove new method getFormalParameters to preserve API compatibility

Refs #912
Refs #881
This commit is contained in:
Andreas Dangel
2018-03-12 20:35:07 +01:00
parent f25e35f42d
commit b6c84e2ba3
4 changed files with 26 additions and 19 deletions

View File

@ -79,11 +79,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`.
`-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 method `ASTConstructorDeclaration.getParameters()` has been deprecated in favor of the new method
`getFormalParameters()`. This method is available for both `ASTConstructorDeclaration` and
`ASTMethodDeclaration`.
### External Contributions
* [#941](https://github.com/pmd/pmd/pull/941): \[java] Use char notation to represent a character to improve performance - [reudismam](https://github.com/reudismam)

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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();
}