| Summary: | [code formatting] if clause jumps into previous line in if statement followed by else | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Palmer Eldritch <the.ubik> | ||||
| Component: | Core | Assignee: | Mateusz Matela <mateusz.matela> | ||||
| Status: | VERIFIED DUPLICATE | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | markus.kell.r, mateusz.matela, Vikas.Chandra | ||||
| Version: | 4.3 | ||||||
| Target Milestone: | 4.9 M2 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | To be verified for 4.9 M2 | ||||||
| Attachments: |
|
||||||
Another example
void instanceMethod(int intExtra) {
String msg = null;
int WifiManager_WIFI_STATE_DISABLING = 0;
int WifiManager_WIFI_STATE_DISABLED = 0;
if (intExtra == WifiManager_WIFI_STATE_DISABLING) msg = "Wireless disabling";
else if (intExtra == WifiManager_WIFI_STATE_DISABLED)
msg = "Wireless disabled";
}
Notice else is just right
This problem no longer occurs, probably after the formatter redesign. *** This bug has been marked as a duplicate of bug 303519 *** verified Version: 4.9 Build id: I20180731-1305 |
Created attachment 238298 [details] formatter profile Reproducer : public class Snippet { public class Editor { public void apply() {} public void commit() {} } { final Editor ed = new Editor(); int android_os_Build_VERSION_SDK_INT = 0; int Build_VERSION_CODES_GINGERBREAD = 0; if (android_os_Build_VERSION_SDK_INT >= Build_VERSION_CODES_GINGERBREAD) ed.apply(); // else ed.commit(); } } All fine. Now uncomment // else ed.commit(); - select all - hit Ctrl+shift+F get : - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) - ed.apply(); + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) ed + .apply(); Notice that GINGERBREAD) ends exactly at column 80 - maybe a fencepost error ? Have seen something similar - will try to dig it up Related probably to my formatter profile requiring simple if statements to be on the same line