This is caused by boxing. Javac interprets 0 == obj as equivalent to Integer.valueOf(0) == obj. More specifically, this is *not* a null pointer check, as the equivalent syntax in C++ would be.
Also, current javac accepts both 0 == obj and obj == 0. It also accepts 0.0 == obj, 1 == obj, and true == obj. More generally, a primitive type can be used anywhere that a supertype of its box is expected.
I would like some clarification here. Is the scope of this bug limited solely to comparisons? If so, then this suggest special rules governing boxing/unboxing for comparisons; this needs to be thought through carefully. For example, consider 1 + 2 == obj, 0.add(1) == obj, etc.