Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
CustomField getType()
Hi,
I've created CustomField like this:
public class SupListEditor<T> extends CustomField<List<T>>{
...
}
What getType method should return to work?
@Override
public Class<? extends List<T>> getType() {
return (Class<? extends List<T>>) List.class;
// return (Class<? extends List<T>>) (new ArrayList<T>()).getClass();
}
Story behind is, that in Eclipse sometimes I get build error if used return from line 3, but it still works afrer trying to build app again, and form works correctly, BUT in Netbeans line 3 gives arror of incompatible types in IDE,
so I found in Vaadin book examples line 4. which gives runtime error (both Eclipse and Netbeans):
com.vaadin.data.util.converter.Converter$ConversionException: Unable to convert value of type org.eclipse.persistence.internal.indirection.jdk8.IndirectList to presentation type class java.util.List.
When I swich from EclipseLink to Hibernate nothing really changes, still there is runtime error of same meaning.
Any help?
Try to check all your imports for List. It's easy to accept a strange import hint from IDE ;-)
And, for me, works following getType method:
@Override
public Class<? extends List<T>> getType() {
//http://stackoverflow.com/questions/4829576/javac-error-inconvertible-types-with-generics
Class clazz = List.class;
return (Class<? extends List<T>>)clazz;
}
Hi Agata,
Your solution works great, both in Eclipse and Netbeans, build runs without any problems ;-)
Thank you very much good lady :-)