Covariant overrides on the Buffer Hierachy

Alan Bateman Alan.Bateman at
Tue Apr 15 08:46:13 UTC 2014

On 15/04/2014 09:05, Richard Warburton wrote:
> :
> The only issue that I'm aware of that is related to this kind of change is
> the requirement to recompile all the classes in the hierarchy when making a
> change [0]. If you don't do this its possible for an infinite recursion and
> eventual stackoverflow to occur. Now as far as I can tell the
> entire hierarchy of Buffer classes are all either package scoped classes,
> or they are public classes with package scoped constructors. So I'm not
> aware of a way to sub class them without the code being part of the JDK.
> This would mean that the subclasses all need to be recompiled, satisfying
> the safety criteria.
This is a long standing bug to look at this issue [1]. 
CharBuffer.subSequence was one case that was retrofitted in 7. As you 
note, buffers are not designed to be extended outside of the java.nio 
package so this should make a number of options possible.



More information about the core-libs-dev mailing list