From 270c684fcfc77995cc751fcfd6fa6d6d646afb1a Mon Sep 17 00:00:00 2001 From: David Craine Date: Mon, 29 Jul 2002 15:48:59 +0000 Subject: [PATCH] Fixed bug when checking native methods git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@545 51baf565-9d33-0410-a72c-fc3788e3496d --- .../net/sourceforge/pmd/rules/UnusedFormalParameterRule.java | 2 +- pmd/test-data/UnusedFormalParam1.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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(){ }