Bug 192285 - [formatter] Java source formatter not working if class has annotation on single line multiple fields declaration.
Summary: [formatter] Java source formatter not working if class has annotation on sing...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-12 16:32 EDT by Alan Feng CLA
Modified: 2008-09-16 09:46 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix + regression test (5.84 KB, patch)
2007-06-14 12:22 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Feng CLA 2007-06-12 16:32:47 EDT
Build ID: M20070212-1330

Steps To Reproduce:
1. Create a new Java class file:
public class FormatTest {
    private String a, 
b, c;

@SuppressWarnings("unchecked")
private Long one, two;
}

2. Press CTRL+SHIFT+F to format the source, nothing happens.

3. Change the class file to:
public class FormatTest {
    private String a, 
b, c;

@SuppressWarnings("unchecked")
private Long one
private Long two;
}

4. Press CTRL+SHIFT+F to format the new source and works as expected.


More information:
When the Java class file contains annotation preceding a single line multiple field declaration, the formatter won't format the source code. In other word, if you have lines like this in your code:
   @SuppressWarnings("unchecked") // can be any annotations
   private Long one, two;  // multiple declarations in single line
The Java source formatter will stop working. 

There is no error messages in the log file.
Comment 1 Olivier Thomann CLA 2007-06-12 16:36:44 EDT
Reproduced with 3.3RC4.
Comment 2 Olivier Thomann CLA 2007-06-14 12:22:50 EDT
Created attachment 71335 [details]
Proposed fix + regression test
Comment 3 Olivier Thomann CLA 2007-06-14 12:23:18 EDT
Good candidate for 3.3.1.
The fix is low risk.
Comment 4 Olivier Thomann CLA 2007-06-22 11:42:34 EDT
Released for 3.4M1 in HEAD.
Waiting approval to release it for 3.3.1.
Comment 5 Olivier Thomann CLA 2007-06-22 11:43:50 EDT
Regression test added in org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test667
Comment 6 Olivier Thomann CLA 2007-07-31 15:05:20 EDT
Jérôme,

candidate for 3.3.1?
Comment 7 Frederic Fusier CLA 2007-08-07 06:08:13 EDT
Verified for 3.4M1 using build I20070806-1800.
Comment 8 Jerome Lanneluc CLA 2007-08-09 07:09:06 EDT
+1 for backporting to 3.3.1
Comment 9 Olivier Thomann CLA 2007-08-13 14:55:08 EDT
Reopen for 3.3.1
Comment 10 Olivier Thomann CLA 2007-08-13 14:57:04 EDT
Released for 3.3.1.
Regression test added in
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test667
Comment 11 Eric Jodet CLA 2007-09-03 09:38:27 EDT
Verified for 3.3.1 using build M20070831-2000