akka/akka — pull request #2006 by retronym (2014-02-13 07:57:07+00:00)
Title: Don't rely on Scala 2.10 compiler bug with inheritance, privates

A subclass should not inherit private members of its parents.
In Scala 2.10, enforcement of this rule was conflated with the
notion of access: a private member of `class C` may be accessed
from its companion.

Two remedies exist: loosen access, or upcast to the parent
type before selecting the private member. I've chosen the former
here.

This is a touch counterintuitive ("why should upcasting ever make
new members visible?"). I double checked this change yesterday
with @odersky, and he answered:

> Yes, the fix matches the spec exactly, as far as I can tell.
> I just verified that javac behaves the same. In
>
> class C {
> private void foo() {}
> void test(D d) { d.foo(); }
> }
>
> class D extends C {}
>
> You get "cannot find symbol" on line 3.

This patch brought to you courtesy of dbuild!