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.
Java 7 allows for underscored in literals (Reference - http://radar.oreilly.com/2011/09/java7-features.html). For example, int value = 1000; could be written as int value = 1_000; The issue is, if it's written as int value = 1_00_0; it equates to 1000, but the IDE doesn't tell the user of possible mistake. Yes, 1_00_0 isn't going to happen... but this may: 1_000_000_000_00_000_000; Notice the missing zero... and yes, this is what the underscores is supposed to help with. My recommendation is to have a warning glyph shown in the gutter to the left, when a 0 is missing between underscores, as I believe that there is no reason to have a set of two (and not three) digits between underscores. Thanks for the consideration, Robert
I may have made a mistake opening this... You may want to use the underscores for other reasons, such as credit cards... e.g., long creditCardNumber = 5555_5555_5555_5555; However, if you thing about it, a credit should probably be a string. This issue requires some thought before correcting.
Here's another example that goes against my reasoning: int socialSecurityID = 111_11_1111;
So far, there is only "Add Underscores" (Tools/Options/Editor/Hints/Language=Java/JDK 5 and later/Add Underscores) - disabled by default. But that pushes the same format to all literals, even those that do not have any underscores. It might be reasonable to add a warning in the future, that would only check consistency for literals which actually use underscores.