On Sat, Sep 21, 2013 at 10:21 PM, Remi Forax <fo...@univ-mlv.fr> wrote: > No, you can add methods to one value of an enum using the anonymous class > syntax. > >
Thanks for pointing this out. This is something that can be clarified in javadoc. Though javadocs of existing factory methods of EnumSet are not so pedantic about "elementType" argument. > elementType and the reified type are the same information. > by the way, elementType and the class of the array (universe) are also the > same information. > > I fail to see a problem here. In fact this is a good case why such method is necessary - if generics get reified in Java 9 and designers of EnumSet decide to remove redundant elementType field, all software depending on existence of this field will break. If on the other hand there was a getElementType() method in Java 8, it could be safely changed to obtain element type through whatever new mechanism is available and existing software using getElementType() keeps working correctly. > I've taken a look to the code, it can be changed to avoid to use > getElementType(), > the parameterized type is not propagated when deserializing. > see the comment here: > https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/ClassNameIdResolver.java#L49 > > That was just an example, there is more code like that out there, including my own and it's not always easy to restructure it in a way that would allow propagating declared type. >> 2. A Visual editor of some sort may display EnumSet as a list of >> checkboxes if it knows what type of enum values can be contained >> within this set. > > > again the declared type can be propagated. >