diff --git a/pmd/src/net/sourceforge/pmd/rules/UnusedFormalParameterRule.java b/pmd/src/net/sourceforge/pmd/rules/UnusedFormalParameterRule.java index d2959d8a3a..9f0a484464 100644 --- a/pmd/src/net/sourceforge/pmd/rules/UnusedFormalParameterRule.java +++ b/pmd/src/net/sourceforge/pmd/rules/UnusedFormalParameterRule.java @@ -43,7 +43,7 @@ public class UnusedFormalParameterRule extends AbstractRule { } public Object visit(ASTMethodDeclaration node, Object data) { - if (node.isPrivate()) { + if (node.isPrivate() && ! node.isNative()) { //make sure it's a private method and not a native method SimpleNode md = (SimpleNode)node.jjtGetChild(1); SimpleNode formalParams = (SimpleNode)md.jjtGetChild(0); int paramCount = formalParams.jjtGetNumChildren(); diff --git a/pmd/test-data/UnusedFormalParam1.java b/pmd/test-data/UnusedFormalParam1.java index 0994a40eb4..af8c6c88bc 100644 --- a/pmd/test-data/UnusedFormalParam1.java +++ b/pmd/test-data/UnusedFormalParam1.java @@ -2,9 +2,11 @@ class UnusedFormalParam1 { private void testMethod(String param1) { - + //System.out.println(param1); } + private native int testNativeMethod(String param1); + private void t2(){ }