A DESCRIPTION OF THE REQUEST :
The current method is defined as such :
public static <E extends Enum<E>> StyleConverter<String,? extends Enum<?>> getEnumConverter(Class<E> enumClass).
This causes the following code to have compile-time error:
public static final CssMetaData<MyNode, MyEnum> MY_ENUM = new CssMetaData<MyNode, MyEnum>(
"-my-enum",
StyleConverter.getEnumConverter(MyEnum.class),
MyEnum.TEST);
This gave the following compile-time error:
The constructor CssMetaData<MyNode,MyEnum>(String, StyleConverter<String,capture#1-of ? extends Enum<?>>, MyEnum) is undefined.
Looking at JavaFX 9 documentation, it seems like this method remains defined this way.
JUSTIFICATION :
I assumed moving the converters from private API to public API means that there is an intention for developers to create their own nodes with their own custom CSS MetaData and properties. I also assumed that there is nothing wrong with calling "new CssMetaData(String, StyleConverter<?, V>, V)", and it's intended.
I believe there is nothing wrong in changing the method definition to "public static <E extends Enum<E>> StyleConverter<String,E> getEnumConverter(Class<E> enumClass)".
CUSTOMER SUBMITTED WORKAROUND :
The current workaround is to do an unchecked cast for the StyleConverter, which will create a warning unless I suppressed it.
The current method is defined as such :
public static <E extends Enum<E>> StyleConverter<String,? extends Enum<?>> getEnumConverter(Class<E> enumClass).
This causes the following code to have compile-time error:
public static final CssMetaData<MyNode, MyEnum> MY_ENUM = new CssMetaData<MyNode, MyEnum>(
"-my-enum",
StyleConverter.getEnumConverter(MyEnum.class),
MyEnum.TEST);
This gave the following compile-time error:
The constructor CssMetaData<MyNode,MyEnum>(String, StyleConverter<String,capture#1-of ? extends Enum<?>>, MyEnum) is undefined.
Looking at JavaFX 9 documentation, it seems like this method remains defined this way.
JUSTIFICATION :
I assumed moving the converters from private API to public API means that there is an intention for developers to create their own nodes with their own custom CSS MetaData and properties. I also assumed that there is nothing wrong with calling "new CssMetaData(String, StyleConverter<?, V>, V)", and it's intended.
I believe there is nothing wrong in changing the method definition to "public static <E extends Enum<E>> StyleConverter<String,E> getEnumConverter(Class<E> enumClass)".
CUSTOMER SUBMITTED WORKAROUND :
The current workaround is to do an unchecked cast for the StyleConverter, which will create a warning unless I suppressed it.
- duplicates
-
JDK-8186187 Modify return type of public API StyleConverter.getEnumConverter()
- Resolved