Community
Participate
Working Groups
In the code snippet below, I have an enum defined inside a class. For serialization purposes, I have 2 constructors: one that initializes the enum's member variable, and one that doesn't. With the save action "Add final modifier to private fields" enabled, eclipse refuses to save the member variable without the 'final' modifier, which, due to the second constructor, causes compilation to fail. I believe this used to work correctly for ancient versions of eclipse. Workarounds: 1/ either disable the save action when saving that file, and re-enable afterwards. 2/ edit the file with a different editor to remove the 'final' keyword. ========== final class Test { enum Code { FOO("Foo."); private final String message; Code(final String message) { this.message = message; } /** * For serialization purposes. */ Code() { // NOP } public String getMessage() { return message; } } } ==========
Test Case: final class Test { enum Code { FOO("Foo."); private String message; Code(final String message) { this.message = message; } Code() { } } }
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.