On 12 August 2011 20:56, Gary Gregory <garydgreg...@gmail.com> wrote: > Hello All: > > For a first cut at generics support in Codec, please checkout the > branch https://svn.apache.org/repos/asf/commons/proper/codec/branches/generics > > I wrote a migration guide in the root of the project called > Codec2-Migration.htm. > > Let's discuss.
The original code used Encoder and Decoder interfaces which operated on Object, and extended these with BinaryEncoder (byte[]) StringEncoder(String) So for example StringEncoder classes need to implement encode(Object) : Object encode(String) : String As far as I can tell, those interfaces cannot be directly generified, because type erasure causes a method signature clash. So adding generics here means breaking binary compatibilty. Question is, what does adding generics to these interfaces actually provide? Would it not be just as effective to deprecate Decoder and Encoder, and code can then use either BinaryEncoder or StringEncoder (etc)? At the moment test code is of the form: Encoder enc = new Base64(); ... byte [] ba = (byte[]) enc.encode(binary)); // unchecked cast However this could be written: BinaryEncoder enc = new Base64(); ... byte [] ba = enc.encode(binary)); // no cast needed > I plan on not touching trunk until the generics code is flushed out > and brought back to trunk. > > Thank you, > Gary > > -- > http://garygregory.wordpress.com/ > http://garygregory.com/ > http://people.apache.org/~ggregory/ > http://twitter.com/GaryGregory > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org