[Codenarc-developer] Add rule for Condition.wait() methods not called inside a loop?
Brought to you by:
chrismair
From: Chris M. <chr...@ea...> - 2011-02-09 02:54:52
|
We added a rule to ensure that the Object.wait() method is only called within a while loop (WaitOutsideOfWhileLoop). The java.util.concurrent.locks.Condition has a similar "requirement" about its await() methods (see the class javadoc). If you see a call to wait(), there is no ambiguity about it being the wrong wait() method, since it is defined on Object. But the await() methods could catch unintended method invocations (false positives) on objects other than Locks. So. is it still worth adding a rule for that? I am tempted to think so. Chris |