I have a custom class which extends HashMap<AnotherCustomClass, YetAnotherCustomClass>, an object of which I need to transport.
When returning via Errai RPC to the client I get:
ClassCastException: org.jboss.errai.common.client.types.UHashMap cannot be cast to my.package.MyCustomClass
EDIT: I definitely need it to work with custom subclasses, as the "YetAnotherCustomClass" also extends LinkedHashMap, and so on. Since I want this fixed quickly, should I contribute it to the Errai source code? If so, how? Or is it already fixed in Errai 2.0, or is it just a quick fix for the Errai devs to do?
EDIT: a simple LinkedHashMap doesn't work either.
What's the best workaround? Or could I be doing something else wrong (i.e. should this work already?)?
Yes, you need to tell Errai what kind of marshaller to use. If it's your own subclass, you can merely specify it in the @Portable annotation. So if you create a subclass of HashMap, merely annotate that class as such: @Portable(aliasOf = Map.class)
If it's not your own implementation, you can specify the mapping in the ErraiApp.properties. You can specify multiple implementations by whitespace seperating them.
This is only as of Errai 2.0 yes? Will the annotation alone work for a custom subclass of LinkedHashMap as well, and preserve the ordering within it? Or do I also need to have an ErraiApp.properties entry for LinkedHashMap as well as the annotation on my custom subclass of it? Either way, will it preserve the LinkedHashMap ordering as specified?