Bug 270983

Summary: [formatter] Enum with field declarations but no constants confuses formatter
Product: [Eclipse Project] JDT Reporter: Matt Whitlock <eclipse>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: frederic_fusier, Olivier_Thomann, srikanth_sankaran
Version: 3.4.2   
Target Milestone: 3.5 M7   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Proposed fix + regression tests none

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