Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 377914 - Code formatter repeatedly adds newline before formatter:off region in enum declaration
Summary: Code formatter repeatedly adds newline before formatter:off region in enum de...
Status: VERIFIED DUPLICATE of bug 303519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 4.8 M6   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard: To be verified for 4.8 M6
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-27 09:57 EDT by Andre Bargull CLA
Modified: 2018-03-08 05:43 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Bargull CLA 2012-04-27 09:57:03 EDT
Build Identifier: Version: Indigo Service Release 2 Build id: 20120216-1857

Whenever the code format action is triggered, the formatter adds another newline before the `//@formatter:off` comment. I'm using a slightly modified version of the "Eclipse [built-in]" code formatter settings. To reproduce the bug the following two options need to be changed:
- Line Wrapping > 'enum' declaration > Constants > Policy -> "Wrap where necessary"
- Off/On Tags -> Enabled

And here's the code in question:
---
package bugs;

public class EclipseFormatBug {
  enum MyEnum {
    // @formatter:off
    someEnumConstantWithLongName,
    anotherEnumConstantWithAnEvenLongerName,
    stillAnotherEnumConstant;
    // @formatter:on
  }
}
---

Reproducible: Always
Comment 1 Stepan Kolesnik CLA 2014-08-20 05:46:56 EDT
This bug is still present in the 4.4 release.
Comment 2 Mateusz Matela CLA 2018-02-05 16:26:11 EST
This problem no longer occurs after the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***
Comment 3 Manoj N Palat CLA 2018-03-08 05:43:56 EST
Verified for Eclipse Photon (4.8) M6 with Build id: I20180306-0800