Andreas Dangel
-
2014-02-01
- status: open --> closed
- assigned_to: Andreas Dangel
- Milestone: New Tickets --> PMD-5.1.0
Hello,
Here a simple ECMAScript function:
function f(a){ a.case.flag = 1; return; }
PMD Rule designer analyzes this assignment as an "EmptyExpression".
Obviouly the problem is the keyword 'case'. The problem is the same if I use 'return' 'for' ... in place of 'case'.
A PMD rule see this "EmptyExpression" in place of an assignment. And this is a big problem because this is a valid assignment.
Here un interactive session with the Rhino shell:
Rhino 1.7 release 3 2011 07 19 js> var a = { }; js> a.case = { }; [object Object] js> a.case.flag = 1; 1 js> a["case"].flag 1 js>
As expected "a.case.flag = 1" is valid assignment.
Regards