Bug 333487 - [formatter] Incorrectly ordered method arguments in Scribe
Summary: [formatter] Incorrectly ordered method arguments in Scribe
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-04 11:00 EST by Michael Pradel CLA
Modified: 2011-01-25 08:45 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 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.