Bug 198920 - [ast rewrite] extract method: Indentation fails if whitespaces are used
Summary: [ast rewrite] extract method: Indentation fails if whitespaces are used
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-06 06:21 EDT by Karsten Becker CLA
Modified: 2023-01-21 14:10 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 Karsten Becker CLA 2007-08-06 06:21:41 EDT
Copy the following code. Do not format it after you pasted it.
class A {
  int f1=3, f2=f1;
  public static void main(String[] args) {
	A a = new A();
	System.out.println("f1: "+ a.f1 + " f2: "+ a.f2);
  }
}
Extract a new method for the System.out.println. The extracted method gets no indentation which looks strange. When the code is formatted the indentation is correct. If a lookup is performed to check what kind of indentation is used before, it should be smart enough to see that 2 whitespaces are used. If it does not perform such checks it should do whatever is specified for that project.
Comment 1 Benno Baumgartner CLA 2007-08-06 08:58:22 EDT
Seams to be an ASTRewriter bug. A method decl is created and added to the body declaration in: ExtractMethodRefactoring.createChange(IProgressMonitor)
Comment 2 Eclipse Genie CLA 2019-01-28 07:22:38 EST
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 3 Dani Megert CLA 2019-01-28 09:42:11 EST
Still an issue in 4.11.
Comment 4 Eclipse Genie CLA 2021-01-18 16:09:33 EST
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 5 Eclipse Genie CLA 2023-01-21 14:10:31 EST
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.