Community
Participate
Working Groups
Consider this code: // --------------------------------------------- public class CurlyBrace { public static void m() { if ("".equals("")) x(" "); else x(" "); // ^ place cursor here and type { } static void x(String s) {} } // --------------------------------------------- Now, place the cursor inside of the second " " string literal and type an opening curly brace. The curly brace isn't placed inside of the string literal, but towards the end of the line instead: // --------------------------------------------- public class CurlyBrace { public static void m() { if ("".equals("")) x(" "); else x(" ") {; // ^ place cursor here and type { } static void x(String s) {} } // --------------------------------------------- Immediately typing backspace will fix this: // --------------------------------------------- public class CurlyBrace { public static void m() { if ("".equals("")) x(" "); else x(" {"); // ^ place cursor here and type { } static void x(String s) {} } // --------------------------------------------- But that's a bit annoying. The "improvement" shouldn't be done in the first place.
The issue can actually be worked around by turning off the preference Java > Editor > Typing > Braces as was kindly pointed out to me by Nándor Előd Fekete on Twitter: https://twitter.com/nandor_fekete/status/989823778594217984
Created attachment 274763 [details] Annimated Gif to demonstrate the problem Add an annimated gif to demonstrate a similar problem. Tested in: Eclipse IDE for Java Developers Version: Photon Release (4.8.0) Build id: 20180619-1200
FWIW I'd never seen this behavior but am now seeing it with 4.13.
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. If you have further information on the current state of the bug, please add it. 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.