Bug 40243 - inline method: loses comments [refactoring]
Summary: inline method: loses comments [refactoring]
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Dirk Baeumer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 80839
Blocks:
  Show dependency tree
 
Reported: 2003-07-16 13:14 EDT by Adam Kiezun CLA
Modified: 2005-02-18 05:48 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2003-07-16 13:14:49 EDT
20030715
inline method loses comments that are places before call sites. 

example:
package p;
public class A {
	private void helper1(int startLine, int startColumn, int endLine, int 
endColumn, boolean replaceAll, boolean makeFinal, String tempName) throws 
Exception{
		helper1(startLine, startColumn, endLine, endColumn, replaceAll, 
makeFinal, tempName, tempName);
	}	

	private void helper1(int startLine, int startColumn, int endLine, int 
endColumn, boolean replaceAll, boolean makeFinal, String tempName, String 
tempName2) {
	}

	public void test0() throws Exception{
//		regression test for bug XYZ  
		helper1(4, 16, 4, 17, false, false, "temp");
	}
}

inline the first helper1
the all-important (for me) comment is gone!
Comment 1 Dirk Baeumer CLA 2003-07-18 04:41:40 EDT
This is done by the AST rewriter. Have to check with Martin what we can do 
here.
Comment 2 Felix Pahl CLA 2004-03-07 03:52:36 EST
This seems rather high-priority to me; I just lost
a comment of several dozen lines but fortunately
noticed it immediately. Let me know whether anyone
is working on this or whether it would help if I
take a look at it.
Comment 3 Dirk Baeumer CLA 2004-03-09 12:41:14 EST
No one is working on this right now (fixing it will not be simple because this 
is automatically done by the AST rewriter). 
Comment 4 Dirk Baeumer CLA 2004-05-18 05:16:13 EDT
Martin, is there anything I can do to control this when I replace helper1(4, 
16, 4, 17, false, false, "temp"); with the method body using the AST rewriter ?
Comment 5 Martin Aeschlimann CLA 2004-05-18 08:55:56 EDT
replace or delete alwasy include comments mapped to the node. Theres no trick 
here to prevent this.
Comment 6 Dirk Baeumer CLA 2005-02-04 06:57:18 EST
Fixed.
Comment 7 Dirk Baeumer CLA 2005-02-07 11:05:56 EST
Marking as fixed.
Comment 8 Dani Megert CLA 2005-02-18 05:48:10 EST
Verified in I20050217-2000 that the initial scenerio is fixed however, if the
remaining helper1 is inlined as well we end up without comment:

	public void test0() throws Exception{
	}

Filed bug 85806 for this.