Update documentation
This commit is contained in:
@ -116,7 +116,6 @@ List of rulesets and rules contained in each ruleset.
|
||||
* [OnlyOneReturn](pmd_rules_java_controversial.html#onlyonereturn): A method should have only one exit point, and that should be the last statement in the method.
|
||||
* [SuspiciousOctalEscape](pmd_rules_java_controversial.html#suspiciousoctalescape): A suspicious octal escape sequence was found inside a String literal.The Java language specificat...
|
||||
* [UnnecessaryConstructor](pmd_rules_java_controversial.html#unnecessaryconstructor): This rule detects when a constructor is not necessary; i.e., when there is only one constructor,i...
|
||||
* [UnnecessaryParentheses](pmd_rules_java_controversial.html#unnecessaryparentheses): Sometimes expressions are wrapped in unnecessary parentheses, making them look like function calls.
|
||||
* [UseConcurrentHashMap](pmd_rules_java_controversial.html#useconcurrenthashmap): Since Java5 brought a new implementation of the Map designed for multi-threaded access, you canpe...
|
||||
* [UseObjectForClearerAPI](pmd_rules_java_controversial.html#useobjectforclearerapi): When you write a public method, you should be thinking in terms of an API. If your method is publ...
|
||||
|
||||
|
@ -627,33 +627,6 @@ public class Foo {
|
||||
}
|
||||
```
|
||||
|
||||
## UnnecessaryParentheses
|
||||
|
||||
**Since:** PMD 3.1
|
||||
|
||||
**Priority:** Medium (3)
|
||||
|
||||
Sometimes expressions are wrapped in unnecessary parentheses, making them look like function calls.
|
||||
|
||||
```
|
||||
//Expression
|
||||
/PrimaryExpression
|
||||
/PrimaryPrefix
|
||||
/Expression[count(*)=1]
|
||||
/PrimaryExpression
|
||||
/PrimaryPrefix
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
|
||||
```
|
||||
public class Foo {
|
||||
boolean bar() {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## UseConcurrentHashMap
|
||||
|
||||
**Since:** PMD 4.2.6
|
||||
|
@ -1530,7 +1530,9 @@ constructors it is easier to distinguish between intentional (commented)
|
||||
and unintentional empty constructors.
|
||||
|
||||
```
|
||||
//ConstructorDeclaration[@Private='false'][count(BlockStatement) = 0 and ($ignoreExplicitConstructorInvocation = 'true' or not(ExplicitConstructorInvocation)) and @containsComment = 'false']
|
||||
//ConstructorDeclaration[@Private='false']
|
||||
[count(BlockStatement) = 0 and ($ignoreExplicitConstructorInvocation = 'true' or not(ExplicitConstructorInvocation)) and @containsComment = 'false']
|
||||
[not(../Annotation/MarkerAnnotation/Name[typeof(@Image, 'javax.inject.Inject', 'Inject')])]
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
|
@ -244,9 +244,14 @@ public Long getId() {
|
||||
Useless parentheses should be removed.
|
||||
|
||||
```
|
||||
//Expression/PrimaryExpression/PrimaryPrefix/Expression
|
||||
[count(*)=1][count(./CastExpression)=0][count(./ConditionalExpression[@Ternary='true'])=0]
|
||||
[not(./AdditiveExpression[//Literal[@StringLiteral='true']])]
|
||||
//Expression[not(parent::PrimaryPrefix)]/PrimaryExpression[count(*)>1]
|
||||
/PrimaryPrefix/Expression
|
||||
[not(./CastExpression)]
|
||||
[not(./ConditionalExpression[@Ternary='true'])]
|
||||
[not(./AdditiveExpression[//Literal[@StringLiteral='true']])]
|
||||
|
|
||||
//Expression[not(parent::PrimaryPrefix)]/PrimaryExpression[count(*)=1]
|
||||
/PrimaryPrefix/Expression
|
||||
|
|
||||
//Expression/ConditionalAndExpression/PrimaryExpression/PrimaryPrefix/Expression[
|
||||
count(*)=1 and
|
||||
@ -257,16 +262,17 @@ Useless parentheses should be removed.
|
||||
|
|
||||
//Expression/ConditionalOrExpression/PrimaryExpression/PrimaryPrefix/Expression[
|
||||
count(*)=1 and
|
||||
count(./CastExpression)=0 and
|
||||
count(./ConditionalExpression[@Ternary='true'])=0 and
|
||||
count(./EqualityExpression/MultiplicativeExpression)=0]
|
||||
not(./CastExpression) and
|
||||
not(./ConditionalExpression[@Ternary='true']) and
|
||||
not(./EqualityExpression/MultiplicativeExpression)]
|
||||
|
|
||||
//Expression/ConditionalExpression/PrimaryExpression/PrimaryPrefix/Expression[
|
||||
count(*)=1 and
|
||||
count(./CastExpression)=0 and
|
||||
count(./EqualityExpression)=0]
|
||||
not(./CastExpression) and
|
||||
not(./EqualityExpression)]
|
||||
|
|
||||
//Expression/AdditiveExpression[not(./PrimaryExpression/PrimaryPrefix/Literal[@StringLiteral='true'])]/PrimaryExpression[1]/PrimaryPrefix/Expression[
|
||||
//Expression/AdditiveExpression[not(./PrimaryExpression/PrimaryPrefix/Literal[@StringLiteral='true'])]
|
||||
/PrimaryExpression[1]/PrimaryPrefix/Expression[
|
||||
count(*)=1 and
|
||||
not(./CastExpression) and
|
||||
not(./AdditiveExpression[@Image = '-']) and
|
||||
@ -283,14 +289,14 @@ Useless parentheses should be removed.
|
||||
|
|
||||
//Expression/EqualityExpression/PrimaryExpression/PrimaryPrefix/Expression[
|
||||
count(*)=1 and
|
||||
count(./CastExpression)=0 and
|
||||
count(./AndExpression)=0 and
|
||||
count(./InclusiveOrExpression)=0 and
|
||||
count(./ExclusiveOrExpression)=0 and
|
||||
count(./ConditionalExpression)=0 and
|
||||
count(./ConditionalAndExpression)=0 and
|
||||
count(./ConditionalOrExpression)=0 and
|
||||
count(./EqualityExpression)=0]
|
||||
not(./CastExpression) and
|
||||
not(./AndExpression) and
|
||||
not(./InclusiveOrExpression) and
|
||||
not(./ExclusiveOrExpression) and
|
||||
not(./ConditionalExpression) and
|
||||
not(./ConditionalAndExpression) and
|
||||
not(./ConditionalOrExpression) and
|
||||
not(./EqualityExpression)]
|
||||
```
|
||||
|
||||
**Example(s):**
|
||||
|
Reference in New Issue
Block a user