Community
Participate
Working Groups
Long enum lines are not split to fit inside max line lenght limit. Tried both Eclipse [built-in] and Java Conventions [built-in] formatters. Example: public enum Foo { BAR, FOOBAR, BAZBAR, FOOBAZ, FOOBARBAZ, BARBAZFOO, BARFOOBAZ, BARFOOBAR, FOOBARFOO, BAZFOOBAZ, FOOBARFOOBAZ, FOOOO } array initializers and function parameters that are similar to enum constant lists are wrapped, so why are enums not? -- Configuration Details -- Product: Eclipse 1.3.1.20100913-1228 (org.eclipse.epp.package.jee.product) Installed Features: org.eclipse.jdt 3.6.1.r361_v20100714-0800-7z8XFUSFLFlmgLc5z-Bvrt8-HVkH
Note: the above example should be having 3 lines: 1: public enum Foo { 2: the values listed 3: }
Line wrapping in enum declarations can be achieved by the Line wrapping tab in Formatter preferences> select 'enum declarations', and at the bottom in "Line wrapping policy" drop down menu, chose 'Wrap where necessary'. Note that both inbuilt formatter settings you used dont have this on by default. So you'll have to create a new formatter profile and switch it on.
Closing as WORKSFORME
Sorry, the question is : why is the default set like it is. What is the reasoning? Why are for example array initializers wrapped, but enums not?
The default settings won't change. They might not have been well defined initially, but changing them would cause changes to formatted code for users that are using the default settings. What you want can be achieved by changing the default formatter profile. Closing as WORKSFORME.
Verified for 3.7M6.