Bug 333487

Summary: [formatter] Incorrectly ordered method arguments in Scribe
Product: [Eclipse Project] JDT Reporter: Michael Pradel <michael>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, Olivier_Thomann
Version: 3.7   
Target Milestone: 3.7 M5   
Hardware: All   
OS: All   
Whiteboard:

Description Michael Pradel CLA 2011-01-04 11:00:36 EST
Build Identifier: M20100211-1343

In class org.eclipse.jdt.internal.formatter.Scribe, there are several variants of method "createAlignment()" that allow calling the actual method with fewer arguments. One of them passes the wrong arguments to the next method, because arguments of the same type aren't ordered correctly:

public Alignment createAlignment(String name, int mode, int count, int sourceRestart, boolean adjust){
  return createAlignment(name, mode, Alignment.R_INNERMOST, count, sourceRestart, adjust);
}

The third parameter of the called method is not 'tieBreakRule' but 'count'. It seems that someone got confused here, which can easily happen as there are multiple int parameters.

The correct method body would be:

return createAlignment(name, mode, count, sourceRestart, this.formatter.preferences.continuation_indentation, adjust);

Reproducible: Always
Comment 1 Olivier Thomann CLA 2011-01-05 08:51:05 EST
This method is not used so the best fix is simply to remove it.
Comment 2 Olivier Thomann CLA 2011-01-05 14:51:49 EST
Released as part of the fix for bug 332843.
Comment 3 Ayushman Jain CLA 2011-01-25 08:45:47 EST
Verified for 3.7M5 using code inspection.