You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by James Ide <id...@berkeley.edu> on 2010/10/18 13:00:40 UTC
(Java) Covariance in generic types of parameters?
Hello,
I'm beginning a new project using Avro and have just gotten to the
code-generation phase. I've noticed that a little message declaration like:
map<string> test(map<string> arg);
is translated into:
Map<CharSequence, CharSequence> test(Map<CharSequence, CharSequence> arg);
Is there a way to generate code that uses covariant parameter types (and
contravariant return types FWIW)? For example, something like:
Map<? super CharSequence, ? super CharSequence> test(Map<? extends
CharSequence, ? extends CharSequence> arg);
Alternatively, is there a way to eliminate lengthy type declarations like
Map<CharSequence, CharSequence> from my code that calls into Avro IPC
methods? Even Map<Utf8, Utf8> looks pretty attractive.
Thanks,
James