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

Bug 511834

Summary: [Formatter] Wrapped line joining and indentation not working as expected
Product: [Eclipse Project] JDT Reporter: Carsten Reckord <reckord>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Carsten Reckord CLA 2017-02-07 07:54:15 EST
I'm having some trouble with the Java formatter regarding line wrapping and indentation. I guess this comes down to "when do lines count as wrapped". My "unformatted" code looks like this:

   try
   {
      //some code here
   }
   catch (@SuppressWarnings("squid:S1166"/*reason to ignore*/) //
         Exception ex)
   {
      //some code here
   }

I have the following pertinent formatter settings active:
- indentation width: 3 Spaces (spaces only)
- Maximum line width: 9999
- Never join already wrapped lines: true
- Default indentation for wrapped lines: 2
- Method Parameters: Wrap when necessary (default indentation)

With this in effect, I would expect the following:

1. With the trailing // on the line of the catch clause removed, the exception should still stay on its own line (due to "Never join"=true)
-> actually, the exception is moved to the line of the catch clause

2. With or without the trailing //, the exception should be indented 2 additional levels (6 spaces) compared to the catch clause (due to "indentation for wrapped lines" = 2)
-> actually it gets indented on the same column as the catch clause
Comment 1 Eclipse Genie CLA 2019-08-19 13:45:33 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.