Fixed bug 1955852 - false positives for UnusedPrivateMethod & UnusedLocalVariable
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6745 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
1 parent
09a89dd005
commit
fcb69f4967
4 files changed
+15
-9
No files matched your search
@@ -409,11 +409,11 @@ Fixed bug 1556594 - Wonky detection of NullAssignment
|
||||
Fixed bug 1481051 - false + UnusedNullCheckInEquals (and other false positives too)
|
||||
Fixed bug 1943204 - Ant task: <ruleset> path should be relative to Ant basedir
|
||||
Fixed patch 2075906 - Add toString() to the rule UnnecessaryWrapperObjectCreation
|
||||
Fixed bug 2338341 - ArrayIndexOutOfBoundsException in cpd on rails project
|
||||
Fixed bug 2315623 - @SuppressWarnings("PMD.UseSingleton") has no effect
|
||||
Fixed bug 2230809 - False +: ClassWithOnlyPrivateConstructorsShouldBeFinal
|
||||
Fixed bug 2338341 - ArrayIndexOutOfBoundsException in CPD (on Ruby)
|
||||
Fixed bug 2315599 - False +: UseSingleton with class containing constructor
|
||||
Fixed bug 1955852 - false positives for UnusedPrivateMethod & UnusedLocalVariable
|
||||
|
||||
ruleset.dtd and ruleset_xml_schema.xsd added to jar file in rulesets directory
|
||||
bin and java14/bin scripts:
|
||||
|
||||
+1
-1
@@ -307,7 +307,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code regressionTest="false">
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Reproducing bug #1955852: false positives for UnusedPrivateMethod & UnusedLocalField
|
||||
]]></description>
|
||||
|
||||
+1
-1
@@ -342,7 +342,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code regressionTest="false">
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Reproducing bug #1955852: false positives for UnusedPrivateMethod & UnusedLocalField
|
||||
]]></description>
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTArguments;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTMemberSelector;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTName;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTPrimaryPrefix;
|
||||
@@ -44,12 +45,16 @@ public class NameFinder {
|
||||
add(new NameOccurrence(grandchild, st.nextToken()));
|
||||
}
|
||||
}
|
||||
if (node instanceof ASTPrimarySuffix && ((ASTPrimarySuffix) node).isArguments()) {
|
||||
NameOccurrence occurrence = names.get(names.size() - 1);
|
||||
occurrence.setIsMethodOrConstructorInvocation();
|
||||
ASTArguments args = (ASTArguments) ((ASTPrimarySuffix) node).jjtGetChild(0);
|
||||
occurrence.setArgumentCount(args.getArgumentCount());
|
||||
|
||||
if (node instanceof ASTPrimarySuffix) {
|
||||
ASTPrimarySuffix suffix = (ASTPrimarySuffix) node;
|
||||
if (suffix.isArguments()) {
|
||||
NameOccurrence occurrence = names.get(names.size() - 1);
|
||||
occurrence.setIsMethodOrConstructorInvocation();
|
||||
ASTArguments args = (ASTArguments) ((ASTPrimarySuffix) node).jjtGetChild(0);
|
||||
occurrence.setArgumentCount(args.getArgumentCount());
|
||||
} else if (suffix.jjtGetNumChildren() == 1 && suffix.jjtGetChild(0) instanceof ASTMemberSelector) {
|
||||
add(new NameOccurrence((JavaNode)suffix.jjtGetChild(0), suffix.jjtGetChild(0).getImage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +67,7 @@ public class NameFinder {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer result = new StringBuffer();
|
||||
for (NameOccurrence occ: names) {
|
||||
|
||||
Reference in new issue
Block a user