covariant returns for CharBuffer.subSequence

kevin bourrillion kevinb at
Sun Aug 3 18:31:52 UTC 2008

On Sat, Aug 2, 2008 at 9:28 PM, Mark Reinhold <mr at> wrote:

> Or just by using covariant return types, which already exist in the
> > language for this very purpose.  Why is everyone so keen to tear up the
> > language, in order to add solutions to problems that already have
> solutions?
> Excellent question!

I think most developers are way too quick to conclude that a language change
is needed to solve any particular problem.  Most of us can't even begin to
understand all the mountainous ramifications and repercussions, nor the
incredible effort to safely rev the JLS, etc.

That said, I just want to address this idea of "adding solutions to problems
that already have solutions."  Because among the four language features (two
existing and two proposed)

- covariant return types
- recursive bounds (Foo<A extends Foo<A>>)
- 'this' type
- void methods implicitly return 'this'

No two of these solve exactly the same set of problems as each other.  Each
addresses at least some situations not addressed by any of the others.  So
we can't effectively dismiss any of them by simply pointing to the existence
of another.  And it's fair to have a discussion about what set of problems
each of the latter two solves that don't have reasonable solutions already.
(But that discussion doesn't belong in this list.)

Kevin Bourrillion @ Google
internal: go/javalibraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the core-libs-dev mailing list