Bug 329709 - [formatter] Formatter fails to format enum with extra semicolon and body
Summary: [formatter] Formatter fails to format enum with extra semicolon and body
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-08 16:06 EST by Brian Atkinson CLA
Modified: 2010-12-07 06:38 EST (History)
2 users (show)

See Also:


Attachments
Proposed fix + regression tests (4.52 KB, patch)
2010-11-09 09:23 EST, 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 Brian Atkinson CLA 2010-11-08 16:06:27 EST
Build Identifier: 20100917-0705

When a enum has two semicolons after the list of enum values, and any body the formatter fails to format the whole file that contains the enum. No exceptions show up in the logs when the formatter fails to run.

Reproducible: Always

Steps to Reproduce:
The following examples fail to format (Java 5):

enum Fail1 {A;;{}}
enum Fail2 {A,B;;{}}
enum Fail3 {A;;public void foo() {}}
enum Fail4 {A;;public int i = 0;}

The following examples do format correctly:

enum Good1 {A;;}
enum Good2 {A,B;;}
enum Good3 {A;;/* blah */}
enum Good4 {A;{}}
enum Good5 {A;public void foo() {}}
enum Good6 {A;public int i = 0;}
Comment 1 Olivier Thomann CLA 2010-11-08 23:07:12 EST
I'll take a look.
Comment 2 Olivier Thomann CLA 2010-11-09 09:23:55 EST
Created attachment 182716 [details]
Proposed fix + regression tests

We need to check for semi-colons before the first member.
Comment 3 Olivier Thomann CLA 2010-11-09 09:25:27 EST
Released for 3.7M4.
Regression tests added in:
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test730
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test731
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test732
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests#test733
Comment 4 Jay Arthanareeswaran CLA 2010-12-07 06:38:14 EST
Verified for 3.7M4 using build I20101206-1800.