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

Bug 355240

Summary: [formatter] Off-by-one error when line-wrapping
Product: [Eclipse Project] JDT Reporter: jwnimmer
Component: CoreAssignee: Mateusz Matela <mateusz.matela>
Status: VERIFIED DUPLICATE QA Contact:
Severity: trivial    
Priority: P3 CC: c_inconnu2, manoj.palat, mateusz.matela
Version: 3.8   
Target Milestone: 4.17 M1   
Hardware: PC   
OS: Linux   
Whiteboard: To be verified for 4.17 M1
Attachments:
Description Flags
Formatter preferences none

Description jwnimmer CLA 2011-08-19 12:21:13 EDT
Build Identifier: I20110613-1736

The formatter disobeys the 80-column limit in a specific case, allowing an 81-character line.  And 82-character line is properly wrapped.

Reproducible: Always

Steps to Reproduce:
Set the maximum line width to 80, and format this class:

public class Sample {
  public static Object test() {
    Object someArgumentName100 = null;
    Object someArgumentName200 = null;
    Object someArgumentName300 = null;
    Other other =
        new Other(someArgumentName100, someArgumentName200,
            someArgumentName300);
    return other;
  }
}

class Other {
  public Other(Object a, Object b, Object c) {}
}

The line with a new call wraps up onto one line, where the ";" is the 81st character, violating the 80-column limit.  Renaming an argument to include one extra character (so yielding an 82-character line) makes the formatter operate correctly.
Comment 1 jwnimmer CLA 2011-08-19 12:21:58 EDT
Created attachment 201812 [details]
Formatter preferences
Comment 2 David DIDIER CLA 2014-02-27 10:12:12 EST
any plan to fix this ? still exists on 4.3 ! thanks
Comment 3 Eclipse Genie CLA 2020-06-11 16:52:40 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Mateusz Matela CLA 2020-06-12 03:40:29 EDT
This problem no longer occurs since the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***
Comment 5 Manoj N Palat CLA 2020-07-08 21:48:37 EDT
Verified for Eclipse Version: 2020-09 (4.17) M1 with Build id: I20200707-1800