Bug 298844 - [formatter] New lines in empty method body wrong behavior
Summary: [formatter] New lines in empty method body wrong behavior
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 RC1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-05 08:13 EST by Nanda Firdausi CLA
Modified: 2010-05-17 03:33 EDT (History)
5 users (show)

See Also:
Olivier_Thomann: review+


Attachments
The patch for the formatter (1.50 KB, patch)
2010-01-05 08:21 EST, Nanda Firdausi CLA
frederic_fusier: iplog+
frederic_fusier: review+
Details | Diff
Additional tests (1.98 KB, patch)
2010-05-06 11:15 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.