Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 468288

Summary: Java code formatter incorrectly formats line comments *not* starting on first column if the option to never indent line comments on first column is enabled
Product: [Eclipse Project] JDT Reporter: Markus Schöpflin <markus.schoepflin>
Component: CoreAssignee: Mateusz Matela <mateusz.matela>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: mateusz.matela
Version: 4.4.2   
Target Milestone: 4.5   
Hardware: PC   
OS: Linux   
Whiteboard: To be verified for 4.6 M6

Description Markus Schöpflin CLA 2015-05-26 06:09:44 EDT
When enabling the Java code formatting options 'Enable line comment formatting' and 'Never indent line comments on first column', automatically wrapped line comments are incorrectly formatted.

Instead of 

    int bar2(); // This is a long comment that should be split in multiple
                // line comments in case the line comment formatting is enabled

you get:

    int bar2(); // This is a long comment that should be split in multiple
// line comments in case the line comment formatting is enabled

This can be seen directly on the comments tab of the Java code formatting options. Simply set the line width to e.g. 100 characters and toggle the option 'Never indent line comments on first column'.
Comment 1 Mateusz Matela CLA 2016-03-13 18:27:27 EDT
This problem no longer occurs after the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***
Comment 2 Markus Schöpflin CLA 2016-03-14 08:49:51 EDT
Does that mean it should work in 4.5.2? (I'm asking because it definitely doesn't work for me.)
Comment 3 Mateusz Matela CLA 2016-03-14 10:00:11 EDT
Yes, I could easily reproduce the bug in 4.4.1 but not in 4.5.2.
Could you test it with a freshly download Eclipse and see if the bug occurs right away or after importing your formatter profile or other settings or after installing specific plugins?
Comment 4 Markus Schöpflin CLA 2016-03-15 03:41:31 EDT
Works on a freshly downloaded install, but not on my upgraded installation. Time to reinstall Eclipse then. Thank you.