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.
Constants are treated specially in the Java language, as usages are inlined by the compiler rather than compiled to field accesses: http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#5313 http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#10931 http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#13.4.9 I think they should be given a distinctive highlight mode, rather than being treated as fields. In particular, in the following class, import java.util.Date; public class CompileTimeConstants { static String a = "a"; static final String b = "b"; static final String c = new String("c"); String d = "d"; final String e = "e"; final String f = new String("f"); static final Object g = "g"; public static final int SEVENTEEN = 17; interface I { String OTHERNAME = "goodbye"; int TEN = 10; Object OH = new Object(); String COMPUTED = new Date().toString(); boolean debug = new Boolean(true).booleanValue(); } } the following fields are in fact constants: b e SEVENTEEN OTHERNAME TEN ('e' is a constant even though nonstatic - that is permitted.) 'a' is not final, 'c' is not initialized with a constant expression, 'g' is not declared to be of primitive or String type, etc. I am not sure offhand what coloring to use for constants, but perhaps simply bold (black) would suffice to distinguish them from regular fields. Of course usages as well as declarations should be highlighted in the same way, e.g. double r = ...; double area = Math.PI * r * r; ^^
Also see issue #88861 re. enum "constants".
Overtake.