forked from phoedos/pmd
Fixed bug 1955852 - false positives for UnusedPrivateMethod & UnusedLocalVariable
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6744 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
???? - 4.2.5:
|
||||
|
||||
Enhanced logging in the ClassTypeResolver to provide more detailed messaging.
|
||||
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
|
||||
|
||||
October 12, 2008 - 4.2.4:
|
||||
|
||||
|
@ -306,7 +306,7 @@ public class Foo {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code regressionTest="false">
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Reproducing bug [ 1955852 ] false positives for UnusedPrivateMethod & UnusedLocalField. The following valid Java code is reported with false positives for UnusedPrivateMethod and UnusedLocalVariable. It looks like the rule does not recognise explicit type arguments to generic methods.]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
|
@ -341,7 +341,7 @@ public class Foo {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code regressionTest="false">
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Reproducing bug [ 1955852 ] false positives for UnusedPrivateMethod & UnusedLocalField. The following valid Java code is reported with false positives for UnusedPrivateMethod and UnusedLocalVariable. It looks like the rule does not recognise explicit type arguments to generic methods.]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
|
@ -4,6 +4,7 @@
|
||||
package net.sourceforge.pmd.symboltable;
|
||||
|
||||
import net.sourceforge.pmd.ast.ASTArguments;
|
||||
import net.sourceforge.pmd.ast.ASTMemberSelector;
|
||||
import net.sourceforge.pmd.ast.ASTName;
|
||||
import net.sourceforge.pmd.ast.ASTPrimaryExpression;
|
||||
import net.sourceforge.pmd.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.getLast();
|
||||
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.getLast();
|
||||
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((SimpleNode)suffix.jjtGetChild(0), ((SimpleNode)suffix.jjtGetChild(0)).getImage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user