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

Bug 85839

Summary: ASTRewrite does not obey preference for empty line between fields
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: dirk_baeumer
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2005-02-18 11:23:14 EST
I20050217-2000

Create new CodeFormatter settings by editing "Java Conventions [built-in]",
enabling "Use tab character" and saving with a new name.

In a project with that formatter, create class p.A:
--------------------------
package p;

public class A {
	private int field;

	public void add() {
		field += INC;
	}
}
--------------------------

- formatting the class should not change anything
- use quick fix to create constant INC
- The new field is inserted without an empty line in between:
	private int field;
	private static final int INC = 0;
- format the class -> an empty line is inserted

I think this is a problem of the ListRewrite. With Extract Constant from HEAD
(rewritten to use ASTRewrite), I see the missing empty line as well.
Comment 1 Martin Aeschlimann CLA 2005-02-18 12:05:19 EST
the ast rewrite has a own heuristic for new lines between elements: It probes
the spacing between existing elements, and if not exist uses 0 for between
fields and 1 beween methods.

I agree that it should probe the formatter at least for the first field/method
Comment 2 Markus Keller CLA 2005-02-18 12:55:02 EST
*** Bug 64954 has been marked as a duplicate of this bug. ***
Comment 3 Martin Aeschlimann CLA 2005-05-23 06:38:46 EDT
not for 3.1
Comment 4 Eclipse Webmaster CLA 2009-08-30 02:41:37 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 5 Markus Keller CLA 2009-11-03 10:11:24 EST
Bug was LATER but is still valid in HEAD.
Comment 6 Eclipse Genie CLA 2020-03-12 15:34:09 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.