7116404: Miscellaneous warnings (java.rmi.**, serialization, some core classes)
Rémi Forax
forax at univ-mlv.fr
Wed Nov 30 16:38:59 UTC 2011
On 11/30/2011 04:50 PM, Alan Bateman wrote:
> On 30/11/2011 15:06, Rémi Forax wrote:
>>
>> Note that you can use clazz.asSubclass(Enum.class) instead of casting
>> to the raw type Class,
>> you will still have a warning but you will be not the one that have
>> introduced a raw type :)
> Your mail arrived just a few minutes after I did the hg push. The only
> thing about using asSubClass(Enum.class) is that it might not be as
> obvious to the reader. As you say it would result in a warning too but
> thanks for going through these changes too.
>
> -Alan
Not a big deal.
If we were before the release of tiger, we can:
- fix the Foo.class syntax to return Class<Foo<?>>
- fix object.getClass() to also returns a wildcard
- fix Enum.valueOf to take an Class<? extends T> instead of a Class<T>
- fix the compiler/spec because Enum<?> should be an <T extends Enum<T>>
Enum<T>
so too many changes and most of them are incompatible with the current
state of the language.
The only way I see to solve the problem now is to add a method in
java.lang.Class
named getEnumConstant() that takes a String an return an Enum<?>.
Rémi
More information about the core-libs-dev
mailing list