Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 480361

Summary: Java formatter does not break an excessively long line
Product: [Eclipse Project] JDT Reporter: Terry Parker <tparker>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: mateusz.matela
Version: 4.5   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Terry Parker CLA 2015-10-21 19:09:14 EDT
The following snippet is formatted with a line length of 80 indentation set at 4. It should break after the assignment token, but even if I manually make that break, the formatter recombines it into a single overly-long line.

	private static final Comparator<BitmapBuilderEntry> ORDER_BY_DESCENDING = new Comparator<BitmapBuilderEntry>() {
		public int compare(BitmapBuilderEntry a, BitmapBuilderEntry b) {
			return Integer.signum(b.getBuilder().cardinality()
					- a.getBuilder().cardinality());
		}
	};
Comment 1 Mateusz Matela CLA 2015-10-24 16:25:24 EDT
Look like you need to change the wrapping policy for Expressions -> Assignments from "Do not wrap" to "Wrap where necessary".
This is due to changed interpretation of the "Never join already wrapped lines" setting in Eclipse Mars, as explained in bug 372801.
There's more discussion about it in bug 474362.