Update documentation

TRAVIS_JOB_NUMBER=3519.1
TRAVIS_COMMIT_RANGE=5d86217871f0...4d357d5624b0
This commit is contained in:
Travis CI (pmd-bot)
2019-03-06 19:11:54 +00:00
parent 4d357d5624
commit 204856f8c8
2 changed files with 32 additions and 26 deletions

View File

@@ -136,6 +136,7 @@ folder: pmd/rules
* [AvoidThrowingNewInstanceOfSameException](pmd_rules_java_design.html#avoidthrowingnewinstanceofsameexception): Catch blocks that merely rethrow a caught exception wrapped inside a new instance of the same typ...
* [AvoidThrowingNullPointerException](pmd_rules_java_design.html#avoidthrowingnullpointerexception): Avoid throwing NullPointerExceptions manually. These are confusing because most people will assum...
* [AvoidThrowingRawExceptionTypes](pmd_rules_java_design.html#avoidthrowingrawexceptiontypes): Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable,Excep...
* [AvoidUncheckedExceptionsInSignatures](pmd_rules_java_design.html#avoiduncheckedexceptionsinsignatures): A method or constructor should not explicitly declare unchecked exceptions in its'throws' clause....
* [ClassWithOnlyPrivateConstructorsShouldBeFinal](pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal): A class with only private constructors should be final, unless the private constructoris invoked ...
* [CollapsibleIfStatements](pmd_rules_java_design.html#collapsibleifstatements): Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with...
* [CouplingBetweenObjects](pmd_rules_java_design.html#couplingbetweenobjects): This rule counts the number of unique attributes, local variables, and return types within an obj...
@@ -161,7 +162,6 @@ folder: pmd/rules
* [NcssTypeCount](pmd_rules_java_design.html#ncsstypecount): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> This rule uses the NCSS (Non-Commenting Source Statements) algorithm to determine the number of l...
* [NPathComplexity](pmd_rules_java_design.html#npathcomplexity): The NPath complexity of a method is the number of acyclic execution paths through that method.Whi...
* [SignatureDeclareThrowsException](pmd_rules_java_design.html#signaturedeclarethrowsexception): A method/constructor shouldn't explicitly throw the generic java.lang.Exception, since itis uncle...
* [SignatureDeclareThrowsRuntimeException](pmd_rules_java_design.html#signaturedeclarethrowsruntimeexception): A method/constructor should not explicitly declare java.lang.RuntimeException or it's subclasses ...
* [SimplifiedTernary](pmd_rules_java_design.html#simplifiedternary): Look for ternary operators with the form 'condition ? literalBoolean : foo'or 'condition ? foo : ...
* [SimplifyBooleanAssertion](pmd_rules_java_design.html#simplifybooleanassertion): Avoid negation in an assertTrue or assertFalse test.For example, rephrase: assertTrue(!expr);a...
* [SimplifyBooleanExpressions](pmd_rules_java_design.html#simplifybooleanexpressions): Avoid unnecessary comparisons in boolean expressions, they serve no purpose and impacts readability.

View File

@@ -5,7 +5,7 @@ permalink: pmd_rules_java_design.html
folder: pmd/rules/java
sidebaractiveurl: /pmd_rules_java.html
editmepath: ../pmd-java/src/main/resources/category/java/design.xml
keywords: Design, AbstractClassWithoutAnyMethod, AvoidCatchingGenericException, AvoidDeeplyNestedIfStmts, AvoidRethrowingException, AvoidThrowingNewInstanceOfSameException, AvoidThrowingNullPointerException, AvoidThrowingRawExceptionTypes, ClassWithOnlyPrivateConstructorsShouldBeFinal, CollapsibleIfStatements, CouplingBetweenObjects, CyclomaticComplexity, DataClass, DoNotExtendJavaLangError, ExceptionAsFlowControl, ExcessiveClassLength, ExcessiveImports, ExcessiveMethodLength, ExcessiveParameterList, ExcessivePublicCount, FinalFieldCouldBeStatic, GodClass, ImmutableField, LawOfDemeter, LogicInversion, LoosePackageCoupling, ModifiedCyclomaticComplexity, NcssConstructorCount, NcssCount, NcssMethodCount, NcssTypeCount, NPathComplexity, SignatureDeclareThrowsException, SignatureDeclareThrowsRuntimeException, SimplifiedTernary, SimplifyBooleanAssertion, SimplifyBooleanExpressions, SimplifyBooleanReturns, SimplifyConditional, SingularField, StdCyclomaticComplexity, SwitchDensity, TooManyFields, TooManyMethods, UselessOverridingMethod, UseObjectForClearerAPI, UseUtilityClass
keywords: Design, AbstractClassWithoutAnyMethod, AvoidCatchingGenericException, AvoidDeeplyNestedIfStmts, AvoidRethrowingException, AvoidThrowingNewInstanceOfSameException, AvoidThrowingNullPointerException, AvoidThrowingRawExceptionTypes, ClassWithOnlyPrivateConstructorsShouldBeFinal, CollapsibleIfStatements, CouplingBetweenObjects, CyclomaticComplexity, DataClass, DoNotExtendJavaLangError, ExceptionAsFlowControl, ExcessiveClassLength, ExcessiveImports, ExcessiveMethodLength, ExcessiveParameterList, ExcessivePublicCount, FinalFieldCouldBeStatic, GodClass, ImmutableField, LawOfDemeter, LogicInversion, LoosePackageCoupling, ModifiedCyclomaticComplexity, NcssConstructorCount, NcssCount, NcssMethodCount, NcssTypeCount, NPathComplexity, SignatureDeclareThrowsException, AvoidUncheckedExceptionsInSignatures, SimplifiedTernary, SimplifyBooleanAssertion, SimplifyBooleanExpressions, SimplifyBooleanReturns, SimplifyConditional, SingularField, StdCyclomaticComplexity, SwitchDensity, TooManyFields, TooManyMethods, UselessOverridingMethod, UseObjectForClearerAPI, UseUtilityClass
language: Java
---
<!-- DO NOT EDIT THIS FILE. This file is generated from file ../pmd-java/src/main/resources/category/java/design.xml. -->
@@ -285,6 +285,36 @@ public class Foo {
<rule ref="category/java/design.xml/AvoidThrowingRawExceptionTypes" />
```
## AvoidUncheckedExceptionsInSignatures
**Since:** PMD 6.13.0
**Priority:** Medium (3)
A method or constructor should not explicitly declare unchecked exceptions in its
`throws` clause. Java doesn't force the caller to handle an unchecked exception,
so it's unnecessary except for documentation. A better practice is to document the
exceptional cases with a `@throws` Javadoc tag, which allows being more descriptive.
**This rule is defined by the following XPath expression:**
``` xpath
//MethodDeclaration/NameList/Name[pmd-java:typeIs("java.lang.RuntimeException")]
|
//ConstructorDeclaration/NameList/Name[pmd-java:typeIs("java.lang.RuntimeException")]
```
**Example(s):**
``` java
public void foo() throws RuntimeException {
}
```
**Use this rule by referencing it:**
``` xml
<rule ref="category/java/design.xml/AvoidUncheckedExceptionsInSignatures" />
```
## ClassWithOnlyPrivateConstructorsShouldBeFinal
**Since:** PMD 4.1
@@ -1343,30 +1373,6 @@ public void foo() throws Exception {
<rule ref="category/java/design.xml/SignatureDeclareThrowsException" />
```
## SignatureDeclareThrowsRuntimeException
**Since:** PMD 1.2
**Priority:** Medium (3)
A method/constructor should not explicitly declare java.lang.RuntimeException or it's subclasses in throws clause of it's signature, since it is advised to avoid declaring unchecked exceptions in method signature.
**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.design.SignatureDeclareThrowsRuntimeExceptionRule](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/SignatureDeclareThrowsRuntimeExceptionRule.java)
**Example(s):**
``` java
import java.lang.RuntimeException;
public void foo() throws RuntimeException {
}
```
**Use this rule by referencing it:**
``` xml
<rule ref="category/java/design.xml/SignatureDeclareThrowsRuntimeException" />
```
## SimplifiedTernary
**Since:** PMD 5.4.0