Merge branch 'pr-556'
This commit is contained in:
@ -1413,6 +1413,7 @@ public void doSomething() {
|
|||||||
since="3.4"
|
since="3.4"
|
||||||
message="Document empty constructor"
|
message="Document empty constructor"
|
||||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||||
|
typeResolution="true"
|
||||||
externalInfoUrl="${pmd.website.baseurl}/rules/java/design.html#UncommentedEmptyConstructor">
|
externalInfoUrl="${pmd.website.baseurl}/rules/java/design.html#UncommentedEmptyConstructor">
|
||||||
<description>
|
<description>
|
||||||
Uncommented Empty Constructor finds instances where a constructor does not
|
Uncommented Empty Constructor finds instances where a constructor does not
|
||||||
@ -1425,8 +1426,10 @@ and unintentional empty constructors.
|
|||||||
<property name="xpath">
|
<property name="xpath">
|
||||||
<value>
|
<value>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
//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')])]
|
||||||
|
]]>
|
||||||
</value>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
<property name="ignoreExplicitConstructorInvocation" type="Boolean" description="Ignore explicit constructor invocation when deciding whether constructor is empty or not" value="false"/>
|
<property name="ignoreExplicitConstructorInvocation" type="Boolean" description="Ignore explicit constructor invocation when deciding whether constructor is empty or not" value="false"/>
|
||||||
|
@ -170,4 +170,32 @@ public class WebAgent {
|
|||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>#357 UncommentedEmptyConstructor consider annotations on Constructor</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
public class MyClass {
|
||||||
|
@Inject MyClass() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</code>
|
||||||
|
</test-code>
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>#357 UncommentedEmptyConstructor consider fully qualified annotations on Constructor</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
public class MyClass {
|
||||||
|
@javax.inject.Inject MyClass() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</code>
|
||||||
|
</test-code>
|
||||||
</test-data>
|
</test-data>
|
||||||
|
@ -82,6 +82,9 @@ and include them to such reports.
|
|||||||
* The rule `UnnecessaryParentheses` (ruleset `java-controversial`) has been merged into `UselessParentheses`
|
* The rule `UnnecessaryParentheses` (ruleset `java-controversial`) has been merged into `UselessParentheses`
|
||||||
(ruleset `java-unnecessary`). The rule covers all scenarios previously covered by either rule.
|
(ruleset `java-unnecessary`). The rule covers all scenarios previously covered by either rule.
|
||||||
|
|
||||||
|
* The rule `UncommentedEmptyConstructor` (ruleset `java-design`) will now ignore empty constructors annotated with
|
||||||
|
`javax.inject.Inject`.
|
||||||
|
|
||||||
#### Removed Rules
|
#### Removed Rules
|
||||||
|
|
||||||
* The deprecated rule `UseSingleton` has been removed from the ruleset `java-design`. The rule has been renamed
|
* The deprecated rule `UseSingleton` has been removed from the ruleset `java-design`. The rule has been renamed
|
||||||
@ -126,6 +129,8 @@ All existing rules have been updated to reflect these changes. If you have custo
|
|||||||
* java-controversial
|
* java-controversial
|
||||||
* [#408](https://github.com/pmd/pmd/issues/408): \[java] DFA not analyzing asserts
|
* [#408](https://github.com/pmd/pmd/issues/408): \[java] DFA not analyzing asserts
|
||||||
* [#537](https://github.com/pmd/pmd/issues/537): \[java] UnnecessaryParentheses fails to detect obvious scenario
|
* [#537](https://github.com/pmd/pmd/issues/537): \[java] UnnecessaryParentheses fails to detect obvious scenario
|
||||||
|
* java-design
|
||||||
|
* [#357](https://github.com/pmd/pmd/issues/357): \[java] UncommentedEmptyConstructor consider annotations on Constructor
|
||||||
* java-sunsecure
|
* java-sunsecure
|
||||||
* [#468](https://github.com/pmd/pmd/issues/468): \[java] ArrayIsStoredDirectly false positive
|
* [#468](https://github.com/pmd/pmd/issues/468): \[java] ArrayIsStoredDirectly false positive
|
||||||
* java-unusedcode
|
* java-unusedcode
|
||||||
@ -173,5 +178,6 @@ All existing rules have been updated to reflect these changes. If you have custo
|
|||||||
* [#550](https://github.com/pmd/pmd/pull/550): \[java] Add basic resolution to type inference - [Bendegúz Nagy](https://github.com/WinterGrascph)
|
* [#550](https://github.com/pmd/pmd/pull/550): \[java] Add basic resolution to type inference - [Bendegúz Nagy](https://github.com/WinterGrascph)
|
||||||
* [#554](https://github.com/pmd/pmd/pull/554): \[java] Fix #537: UnnecessaryParentheses fails to detect obvious scenario - [Clément Fournier](https://github.com/oowekyala)
|
* [#554](https://github.com/pmd/pmd/pull/554): \[java] Fix #537: UnnecessaryParentheses fails to detect obvious scenario - [Clément Fournier](https://github.com/oowekyala)
|
||||||
* [#555](https://github.com/pmd/pmd/pull/555): \[java] Changed metrics/CyclomaticComplexityRule to use WMC when reporting classes - [Clément Fournier](https://github.com/oowekyala)
|
* [#555](https://github.com/pmd/pmd/pull/555): \[java] Changed metrics/CyclomaticComplexityRule to use WMC when reporting classes - [Clément Fournier](https://github.com/oowekyala)
|
||||||
|
* [#556](https://github.com/pmd/pmd/pull/556): \[java] Fix #357: UncommentedEmptyConstructor consider annotations on Constructor - [Clément Fournier](https://github.com/oowekyala)
|
||||||
* [#557](https://github.com/pmd/pmd/pull/557): \[java] Fix NPath metric not counting ternaries correctly - [Clément Fournier](https://github.com/oowekyala)
|
* [#557](https://github.com/pmd/pmd/pull/557): \[java] Fix NPath metric not counting ternaries correctly - [Clément Fournier](https://github.com/oowekyala)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user