RFR (M): JDK-6394757: rev1: AbstractSet.removeAll semantics are surprisingly dependent on relative sizes

Martin Buchholz martinrb at google.com
Tue May 28 17:47:24 UTC 2019


On Mon, May 27, 2019 at 1:35 AM Peter Levart <peter.levart at gmail.com> wrote:

>
>
> On 5/26/19 6:25 PM, Martin Buchholz wrote:
> > On Mon, May 13, 2019 at 5:29 PM Stuart Marks <stuart.marks at oracle.com>
> > wrote:
> >
> >>    - addition of FIXME comment and reference to javadoc bug report,
> where
> >> doc
> >> comment from interface cannot be inherited
> >>
> > This is yet another symptom of Java's fundamental design mistake of being
> > unable to simply inherit implementation, that we have learned to live
> with.
> > "Inheritance is not subtyping"
>
> One way of inheriting "only implementation" is to have a package-private
> superclass with public methods. (AbstractStringBuilder for example). It
> confines all implementations (subclasses) to the same package though, so
> it is not a universal tool. With jigsaw there is another possibility: a
> public but internal (confined) superclass which is exported just to
> modules that need to subclass it.
>

These are useful techniques, but good reusable snippets of implementation
should often be public, and the unit of reusability should somehow include
javadoc (in two flavors, for subclassers and callers).  Default methods in
interfaces are another partial solution to the implementation reuse problem.


More information about the core-libs-dev mailing list