On 7/9/2014 6:35 PM, Joe Darcy wrote:
Hi Mandy,

On 07/09/2014 06:26 PM, Mandy Chung wrote:

On 7/9/2014 6:10 PM, Joe Darcy wrote:
Hello,

Another batch of lint warnings removal; this time for

    8049820: Fix raw and unchecked lint warnings in sun.management
    http://cr.openjdk.java.net/~darcy/8049820.0/

 230         @SuppressWarnings("rawtypes")
 231         final Class enumClass;

Why can't the enumClass field be declared of Class<?> type?

Other than that, looks fine.
Mandy


My first attempt at generifying this class used Class<?> as you suggest. The problem occurs in the call to the static method Enum.valueOf which has a declaration of

    public static <T extends Enum<T>> T valueOf(Class<T> enumType,
                                                String name)

The problem here is the recursive "T extends Enum<T>", following the recursive F-bound of the java.lang.Enum type itself. Using a wildcard for Class<?> doesn't work with this method signature; something like Class<? extends Enum> doesn't work either because the more specific recursive binding is not captured, so I reluctantly fell back to using a raw type.

I see, thanks.  The patch is good to go.
Mandy

Reply via email to