Unfortunately, this is the way the aliasing facility works in Errai Marshalling: "aliases do not inherit functionality."
The Map marshaller always produces an instance of HashMap when it's demarshalling. Since you have aliased MyLinkedHashMap to Map, you will always get back a HashMap when demarshalling. Not what you want, I know.
If you can do away with the custom subclass, that would be easiest. Errai Marshalling preserves map ordering for field types java.util.LinkedHashMap and java.util.SortedMap.
Otherwise, you will have to create a custom marshaller for MyLinkedHashMap. It's not so bad, because you can extend MapMarshaller. Use LinkedMapMarshaller as your guide:
Hope that helps,
I'll try that out.
Are there any plans to make this unnecessary? I like subclassing as I've other related functionality & variables. And there are quite a few so I'd have to bloat my code a tiny bit, maybe, with a custom marshaller for each, right? Ideally I'd just be able to do @Portable class MyLinkedHashSet extends LinkedHashSet but I don't know if that'll ever be possible.
Hi, subclassing MapMarshaller wasn't possible for my custom LinkedHashMap since MapMarshaller is type-bound to a Map<Object, Object>, and my custom one had specified key & value types. Otherwise, where would I need to place the custom marshaller to make it work? Anywhere in my project? Has errai been updated to allow direct marshalling of subclasses of LinkedHashMap since I first asked this?