• New Feature
  • Status: Closed
  • 0 Showstopper
  • Resolution: Won't Fix
  • drb
  • Reporter:
  • June 22, 2007
  • 0
  • Watchers: 0
  • July 27, 2012
  • June 25, 2007

Description

Many of the issues around enums have been resolved, but there is still this caveat:

f you define an enum that contains state:

enum MutableEnum { A, B;

private int fVal;

public void setValue(int i) { fVal = i; }

public int getValue() { return fVal; } }

You can share the enum value but the state will not be shared. If you make this a root and view it in the AdminConsole, you will not see fVal. In fact, in the console we treat enums as simple literals: enumRoot=A.

Comments

orion 2007-06-22

QA should check to make sure this is still an issue. If it is, then we need to put this in the release notes.

Sreenivasan Iyer 2007-06-22

We do have some folks requesting support for Mutable Enums…

Tim Eck 2007-06-22

This was conscious design decision way back when. The strongest argument is that seriailzation of enum instances (nothing to do with DSO) does not preserve mutable state either

There really should be a FindBugs plugin that detects mutable enums.

orion 2007-06-22

Ok. I was going to make this a release note, but maybe the best way to deal with this is to document it in a special “gotcha’s” page and close this issue. We could collect a bunch of weird gotchas in one place (like the lock, then share issue; the non-autolocked collections issue, etc.).

Fiona OShea 2007-06-25

please verify that this is still an issue, if so add comment as to what the issue is and assign back to Issue Review Board. thanks

Hung Huynh 2007-06-25

no action has taken against this one