Bug 270983 - [formatter] Enum with field declarations but no constants confuses formatter
Summary: [formatter] Enum with field declarations but no constants confuses formatter
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-02 11:18 EDT by Matt Whitlock CLA
Modified: 2009-04-28 09:04 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix + regression tests (6.09 KB, patch)
2009-04-02 11:57 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 Matt Whitlock CLA 2009-04-02 11:18:15 EDT
Build ID: M20090211-1700

The following is legal Java code:

public enum MyEnum {
    ;
    private int foo;
}

but the code formatter chokes.  Interestingly, if the field declaration is commented out, the formatter works fine.  Also, method declarations in the enum do not cause a problem, as long as there are no field declarations.
Comment 1 Olivier Thomann CLA 2009-04-02 11:57:46 EDT
Created attachment 130716 [details]
Proposed fix + regression tests
Comment 2 Olivier Thomann CLA 2009-04-02 12:00:02 EDT
Released for 3.5M7.
Regression tests added in:
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test720
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test721
Comment 3 Srikanth Sankaran CLA 2009-04-28 09:04:20 EDT
Verified for 3.5M7 using I20090426-2000