Bug 152850

Summary: [formatter] Formatter marks unchanged file dirty
Product: [Eclipse Project] JDT Reporter: Nick Veys <psylence519>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.2   
Target Milestone: 3.3 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Nick Veys CLA 2006-08-04 11:51:51 EDT
IIRC, the formatter is not supposed to touch a file if no changes are made to it.  The following class breaks this:

public class Test {
  /**
   * Any text
   * 
   * @param b
   */
  public void a(int b) {
  }
}

You can repeatedly Format, Save, Format, Save.  It always marks it dirty.  If you change it to:

public class Test {
  /**
   * @param b
   */
  public void a(int b) {
  }
}

It works as expected.  Also removing the @param and leaving the description text  works as expected as well.  Something with having both the description and @param tag (or any tag actually).  Which pretty much means every documented class.

An Undo will show a selected area of the whole blank line after the * up to the @ of the tag.
Comment 1 Dani Megert CLA 2006-08-04 12:27:43 EDT
Can reproduce using R3.2 or latest 3.3 build.
Happens as soon as there's a Javadoc comment.
Comment 2 Dani Megert CLA 2006-08-06 10:53:53 EDT
JDT Core gives us back edits.
Comment 3 Olivier Thomann CLA 2007-02-15 16:34:07 EST
We can detect that no edit are required.
I added an extra check when creating the optimized edits inside the scribe.
Released for 3.3M6.
Added regression test in org.eclipse.jdt.core.tests.formatter.comment.JavaDocTestCase#test152850
Comment 4 David Audel CLA 2007-03-20 13:31:49 EDT
Verified for 3.3 M6 using build I20070320-0010