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.
Created attachment 146768 [details] Example for showing instability in code formatting. Invoking formatter many times in a row gives different results! Comment formatting works incorrectly. Sometimes comments are UNCOMMENTED by formatter!!! (in my case it depends on number of spaces used before comment, but I believe there may be more such cases). To be precise it happens to incorrectly indented comments which appear just before javadocs. This may lead to some serious issues. If you try to reformat whole project (as I did) you should start to be worried. For example just try to reformat following code using default NB settings (7.4 or 8.0, openSuse 13.1, Win 7, Java 1.7_51). (get attached file to make sure you are using the same number of spaces as I did) ------------------------------------------------------------------ /** * This is class example for showing instability in code formatting. * Invoking formatter many times in a row gives different results!!!! * Tested in NB 7.4, 8.0, Windows 7, OpenSuse 13.1 * * @author Marcin Szpak, Laboratory of Visual Analysis ICM, University of Warsaw */ public class NetbeansFormattingBug { //this comment is going to be UNCOMMENTED! /** * javadoc here */ public static void main(String[] args) { } //this comment is going to be PARTLY UNCOMMENTED! /** */ public void method1() { } //this comment is going CRAZY /** */ public void method2() { } //public void superMethod() {} //this one will be uncommented which may lead to some SERIOUS PROBLEMS!! /** */ public void method3() { } }
Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/42e8081119d3
Integrated into 'main-silver', will be available in build *201404200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/42e8081119d3 User: Dusan Balek <dbalek@netbeans.org> Log: Issue #243851: Formatting comments can uncomment them! Which may lead to semantic change of code! - fixed.
Hi Dusan Balek Could you please tell me if this issue was only related to comments just before java docs? Were there any other cases when such problem could appear? Thanks Marcin
verified in trunk
Integrated into release80. http://hg.netbeans.org/releases/rev/bac54ca1dbd3
To Marcin: yes, the problematic case was a line comment directly followed by javadoc.
All right. Thanks!
Integrated into 'releases/release80', will be available in build *201404240045* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/bac54ca1dbd3 User: Dusan Balek <dbalek@netbeans.org> Log: Issue #243851: Formatting comments can uncomment them! Which may lead to semantic change of code! - fixed.