This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Most people forget that when performing an identity comparison between numeric/boolean types, they might be using boxed versions... not the primitives. The example shows a typical case. There should be a hint to either:- - unbox the Type to a primitive, e.g. use .longValue() - use .equals() The hint could serve as a reminder for case b below when dealing with (at least) - Boolean - Byte - Character - Short - Integer - Long - Float - Double similar to the way there is a warning when String is identity compared. @see http://java.sun.com/docs/books/jls/third_edition/html/conversions.html ================ public class Scratch { public static final void main(String[] args) { Long n = new Long(0); // XXX not always true! 0 is being boxed to Long System.out.println(n == 0); Long m = new Long(0); System.out.println(n == m); } }