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

Bug 158288

Summary: [quick assist] 'Split || condition': syntax error and wrong indentation
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: katzyn
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2006-09-22 08:06:39 EDT
I20060922-0010, default Eclipse code formatter

public class Try {
	public static void main(String[] args) {
		if (args[0] == "Blabla Blabla Blabla BlablaBlabla" //$NON-NLS-1$
				|| args[0] == "abcabcabcabcabc") { //$NON-NLS-1$
			System.out.println("Hello"); //$NON-NLS-1$
		}
	}
}

- caret at ||
- result of 'Split || condition' quick assist:

public class Try {
	public static void main(String[] args) {
		if (args[0] == "Blabla Blabla Blabla BlablaBlabla" //$NON-NLS-1$) { //$NON-NLS-1$
System.out.println("Hello"); //$NON-NLS-1$
}
		if (args[0] == "abcabcabcabcabc") { //$NON-NLS-1$
System.out.println("Hello"); //$NON-NLS-1$
}
	}
}

=> syntax error on line 'if (args[0] == "Blabla ...': the tokens ') {' after //$NON-NLS-1$ are on same line and therefore commented out

=> indentation of System.out.println wrong (this also happens without the //$NON-NLS-1$ tags)
Comment 1 Eugene Ryazanov CLA 2017-09-06 21:50:34 EDT
This issue is still reproducible with 4.7.0. && condition is also affected.

class A {
	void a() {
		if ("".isEmpty() //$NON-NLS-1$
				&& true) {
			//
		}
	}
}
Comment 2 Eclipse Genie CLA 2020-02-29 13:16:00 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.