View | Details | Raw Unified | Return to bug 210922 | Differences between
and this patch

Collapse All | Expand All

(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-1 / +1 lines)
Lines 118-124 Link Here
118
	 * retrieve correct upper and lower bounds and replace the region.
118
	 * retrieve correct upper and lower bounds and replace the region.
119
	 */
119
	 */
120
	private void adaptRegions() {
120
	private void adaptRegions() {
121
		this.adaptedRegions = new Region[this.regions.length];
121
		this.adaptedRegions = new IRegion[this.regions.length];
122
		for (int i = 0, max = this.regions.length; i < max; i++) {
122
		for (int i = 0, max = this.regions.length; i < max; i++) {
123
			IRegion aRegion = this.regions[i];
123
			IRegion aRegion = this.regions[i];
124
			int offset = aRegion.getOffset();
124
			int offset = aRegion.getOffset();
(-)buildnotes_jdt-core.html (-1 / +3 lines)
Lines 56-62 Link Here
56
</ul>
56
</ul>
57
57
58
<h3>Problem Reports Fixed</h3>
58
<h3>Problem Reports Fixed</h3>
59
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=210353">210353</a>
59
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=210922">210922</a>
60
ArrayStoreException when formatting set of regions
61
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=210353">210353</a>
60
Improve documentation for overridingPackageDefaultMethod option in JavaCore#getDefaultOptions' javadoc
62
Improve documentation for overridingPackageDefaultMethod option in JavaCore#getDefaultOptions' javadoc
61
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=208541">208541</a>
63
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=208541">208541</a>
62
[formatter] Formatter does not format whole region/selection
64
[formatter] Formatter does not format whole region/selection
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java (+20 lines)
Lines 9675-9678 Link Here
9675
		};
9675
		};
9676
		runTest(codeFormatter, "test692", "A.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$
9676
		runTest(codeFormatter, "test692", "A.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$
9677
	}
9677
	}
9678
	
9679
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=210922
9680
	public void test693() {
9681
		final class MyRegion implements IRegion {
9682
			public int getLength() {
9683
				return 0;
9684
			}
9685
			public int getOffset() {
9686
				return 0;
9687
			}			
9688
		}
9689
		final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
9690
		DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
9691
		preferences.line_separator = "\n";//$NON-NLS-1$
9692
		DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
9693
		IRegion[] regions = new IRegion[] {
9694
				new MyRegion()
9695
		};
9696
		runTest(codeFormatter, "test693", "A.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$
9697
	}
9678
}
9698
}
(-)workspace/Formatter/test693/A_out.java (+5 lines)
Added Link Here
1
package pkg1;
2
public class A {
3
        int i = 1;     
4
5
}
(-)workspace/Formatter/test693/A_in.java (+5 lines)
Added Link Here
1
package pkg1;
2
public class A {
3
        int i = 1;     
4
5
}

Return to bug 210922