I have a method which looks like this:
public static <T extends Enum<T> & Marshallable> String foo(Collection<T> collection, Class<? extends Marshallable>... marshallables);
So I'm expecting the collection passed to be a Enum implementing Marshallable interface. It works fine if I have the concrete Enum types at runtime but I wrote a test method which creates an Enum list(implementing Marshallable) dynamically from class object, and I am having trouble passing this list into method above.
@Test
public void fooTest() {
...
if (clazz.isEnum()) { // collection enum xml
List<? extends Enum<? extends Marshallable>> enumList = (List<? extends Enum<? extends Marshallable>>) Arrays.asList(clazz.getEnumConstants());
--> String enumListXml = foo(enumList, clazz);
...
Marked line will give compilation error. I couldn't figure out how to pass the list without changing method signatures.