Re: Expose elementType of EnumSet and EnumMap

2013-09-22 Thread Remi Forax
On 09/21/2013 11:32 PM, Marcin Wiśnicki wrote: 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

Reified Generics (was Re: Expose elementType of EnumSet and EnumMap)

2013-09-22 Thread Gili
On 9/22/2013 5:17 AM, Remi Forax wrote: 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.

Re: Expose elementType of EnumSet and EnumMap

2013-09-22 Thread Marcin Wiśnicki
On Sun, Sep 22, 2013 at 11:17 AM, Remi Forax fo...@univ-mlv.fr wrote: There is a lot of code that cast to T or to EnumSetT that will start to fail at runtime if generics are reified. Yes, but how is that relevant ? Most of the code using reflection or unchecked casts will likely fail if

Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Marcin Wiśnicki
Third party serialization libraries and other tools need to know the type of EnumSet elementType. Currently this field is package-private and said libraries have to resort to non-portable reflection hacks. Please add EnumSet#getElementType() and EnumMap#getKeyType() methods. I've submitted this

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Andreas Rieber
Hi Marcin, your issue is here: https://bugs.openjdk.java.net/browse/JDK-8024037 try the new JDK bug system ;-) Andreas On 21.09.2013 17:27, Marcin Wiśnicki wrote: Third party serialization libraries and other tools need to know the type of EnumSet elementType. Currently this field is

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Marcin Wiśnicki
Nice, are submissions converted automatically ? Still it's basically useless for outsiders - there is no public registration and without it I can't create new issues, add comment or even watch existing issues. On Sat, Sep 21, 2013 at 6:06 PM, Andreas Rieber rieberandr...@gmail.com wrote: Hi

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Remi Forax
On 09/21/2013 05:27 PM, Marcin Wiśnicki wrote: Third party serialization libraries and other tools need to know the type of EnumSet elementType. Currently this field is package-private and said libraries have to resort to non-portable reflection hacks. Please add EnumSet#getElementType() and

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Marcin Wiśnicki
First of all EnumSet/EnumMap are not general purpose collections, they are already implementation specific. Also, since you can't subclass enum, class of contained values will be the same as declaring class. From EnumSet documentation: All of the elements in an enum set must come from a single

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Remi Forax
On 09/21/2013 08:43 PM, Marcin Wiśnicki wrote: First of all EnumSet/EnumMap are not general purpose collections, they are already implementation specific. Also, since you can't subclass enum, class of contained values will be the same as declaring class. From EnumSet documentation: All of the

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Joe Darcy
On 9/21/2013 11:43 AM, Marcin Wiśnicki wrote: First of all EnumSet/EnumMap are not general purpose collections, they are already implementation specific. Also, since you can't subclass enum, class of contained values will be the same as declaring class. No, not necessarily. Specialized enum

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Marcin Wiśnicki
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

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Marcin Wiśnicki
On Sat, Sep 21, 2013 at 11:32 PM, Marcin Wiśnicki mwisni...@gmail.com wrote: 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

Re: Expose elementType of EnumSet and EnumMap

2013-09-21 Thread Stephen Colebourne
FWIW, I'm surprised that these methods don't exist. I've not hit the problem myself but I know I'd curse if I discovered their absence. Stephen On 21 Sep 2013 08:35, Marcin Wiśnicki mwisni...@gmail.com wrote: Third party serialization libraries and other tools need to know the type of EnumSet