Bug 298844

Summary: [formatter] New lines in empty method body wrong behavior
Product: [Eclipse Project] JDT Reporter: Nanda Firdausi <nanda.firdausi>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: frederic_fusier, jarthana, nanda.firdausi, Olivier_Thomann, satyam.kandula
Version: 3.5.1Flags: Olivier_Thomann: review+
Target Milestone: 3.6 RC1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
The patch for the formatter
frederic_fusier: iplog+, frederic_fusier: review+
Additional tests none

Description Nanda Firdausi CLA 2010-01-05 08:13:25 EST
Build Identifier: 20090920-1017

The option 'New lines in empty method body wrong behavior' is deactivated and the rest is like Java convention.

When I have a method/constructor with only comment(s), it will be formatted like this:

public Thread() {
// TODO Auto-generated constructor stub
}

I think the correct indentation is like this:

public Thread() {
    // TODO Auto-generated constructor stub
}

Reproducible: Always

Steps to Reproduce:
1. Set the formatter options like I mention in the description
2. Create a class with an empty constructor
Comment 1 Nanda Firdausi CLA 2010-01-05 08:21:19 EST
Created attachment 155321 [details]
The patch for the formatter

This is the patch for the problem.
Comment 2 Nanda Firdausi CLA 2010-05-04 09:01:14 EDT
why it takes so long to apply the patch to 3.6?
Comment 3 Olivier Thomann CLA 2010-05-04 09:45:58 EDT
It takes so long because we missed it. Thanks for reminding us to take a look.
Could you please provide a regression test?
Comment 4 Frederic Fusier CLA 2010-05-06 11:15:10 EDT
Created attachment 167320 [details]
Additional tests

Added two tests to verify the proposed fix...
Comment 5 Frederic Fusier CLA 2010-05-06 11:15:35 EDT
Comment on attachment 155321 [details]
The patch for the formatter

Patch is good for me
Comment 6 Frederic Fusier CLA 2010-05-06 11:15:59 EDT
Olivier, OK for RC1?
Comment 7 Olivier Thomann CLA 2010-05-06 11:18:06 EDT
+1.
Comment 8 Olivier Thomann CLA 2010-05-06 17:02:28 EDT
Released for 3.6RC1.
Regression tests added in:
org.eclipse.jdt.core.tests.formatter.FormatterBugsTests#testBug298844a
org.eclipse.jdt.core.tests.formatter.FormatterBugsTests#testBug298844b
Comment 9 Satyam Kandula CLA 2010-05-17 03:27:20 EDT
Verified for 3.6RC1 using build I20100513-150
Comment 10 Jay Arthanareeswaran CLA 2010-05-17 03:33:26 EDT
Verified.