Community
Participate
Working Groups
Build id: I20100119-0800 public void v(Object o) { while (true) { o.toString(); // claims it may be null if (o != null); // claims it can't be null } } public void v2(Object o) { o = new Object(); while (true) { o.toString(); // claims it may be null if (o != null); // claims it can't be null } } If you delete the if statement, then the warning on the toString() call will disappear.
Ayush, please investigate.
I think this got fixed with bug 293917. Remy, can you apply the patch given in bug 293917 and check again? I dont get the spurious warnings on the toString() call anymore.
(In reply to comment #2) > I think this got fixed with bug 293917. > Remy, can you apply the patch given in bug 293917 and check again? I dont get > the spurious warnings on the toString() call anymore. The bug does not occur with N20100121 so I guess the problem has been resolved (indirectly?). *** This bug has been marked as a duplicate of bug 293917 ***
Yes this is has been fixed. Earlier, whenevr a null check was done against a local variable, it got 'tainted' and marked as maybe null. Since in a loop, null check warnings are always deferred till the end of the loop, at the time of deciding whether o in o.toString() is null or not, it'd have already got unnecessarily tainted by the if statement. Hence the warning. This unnecessary tainting of local variables is done away with now.