[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about NullPointerChecker
Hi,
I'm trying to use the Soot 2.1.0 NullPointerChecker ("jap.npc") to
eliminate implicit null pointer checks. This seems to work fine in
situations like this:
Class c;
if (obj != null)
c = obj.getClass(); <-- null check eliminated here
we know that "obj" is not null
However, it seems like the NullPointerChecker misses two easy
optimizations: when the base is "this" and when the base is an
object that was just created via "new". Clearly an object cannot
possibly be null in either of those cases. Unfortunately, these
cases are much more common (in my application) than the above
example.
Does NullPointerChecker really not handle those two cases, or
am I just doing something wrong in the way I'm using it?
If these optimizations are really missing, I'd like to add them.
Any suggestions as to the right way to do that are appreciated.
Thanks,
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com