From 8b527ccfe4fe97a92eb3e2a99b76bdb39163e293 Mon Sep 17 00:00:00 2001 From: Xavier Le Vourch Date: Fri, 1 Dec 2006 07:10:26 +0000 Subject: [PATCH] bug fix: detection of extra parenthesis was not correct, selfassigned returned true for more than cases such as '(i)++' git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4852 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/src/net/sourceforge/pmd/symboltable/NameOccurrence.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pmd/src/net/sourceforge/pmd/symboltable/NameOccurrence.java b/pmd/src/net/sourceforge/pmd/symboltable/NameOccurrence.java index ade27ee221..632d4c8e4b 100644 --- a/pmd/src/net/sourceforge/pmd/symboltable/NameOccurrence.java +++ b/pmd/src/net/sourceforge/pmd/symboltable/NameOccurrence.java @@ -146,7 +146,8 @@ public class NameOccurrence { // deal with extra parenthesis: "(i)++" if (p instanceof ASTPrimaryPrefix && p.jjtGetNumChildren() == 1 && gp instanceof ASTPrimaryExpression && gp.jjtGetNumChildren() == 1&& - node instanceof ASTExpression && node.jjtGetNumChildren() == 1) { + node instanceof ASTExpression && node.jjtGetNumChildren() == 1 && + node.jjtGetParent() instanceof ASTPrimaryPrefix && node.jjtGetParent().jjtGetNumChildren() == 1) { l = node; continue; }