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

Bug 256087

Summary: [typing] Automatically close brace does not work properly
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: TextAssignee: Dani Megert <daniel_megert>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.4   
Target Milestone: 3.5 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Frederic Fusier CLA 2008-11-21 05:53:47 EST
Build I20081118-1720.

I have the following simple line of code:

if (condition) return false;

I want to insert brace around the single statement of the if  block.
For this, I only type a brace just before the return and simply hit 'Enter':

if (condition) {return false;

As my Java editor preference 'Automatically close {braces}' is checked,
I would expect to get the following code:

if (condition) {
    return false;
}

But I get the following code instead:

if (condition) {
    
}return false;


As this code does not compile, it's a little bit annoying...
Comment 1 Frederic Fusier CLA 2008-11-21 05:58:11 EST
Note that it worked until 3.5M2 but was broken in 3.5M3...
Comment 2 Dani Megert CLA 2008-11-24 04:03:33 EST
This got broken during 3.5 M3.
Comment 3 Dani Megert CLA 2008-11-24 07:56:30 EST
Fixed in HEAD.
Available in builds > N20081123-2000.