'protected[package]' no much of a protection after all

3 replies

Tue, 2011-07-26, 07:30

Gerolf Seitz

Joined: 2011-07-26,

Hi,As far as I understand, a trait declared as "protected[mypackage] trait MyTrait" shouldonly be accessible from inside the "mypackage" package.However, this is not at all the case. The code in this gist [0] compiles and runs fine.
Is there a misunderstanding on my part or is it a bug/regression?[0] https://gist.github.com/1106103

On 26/07/2011 08:29, Gerolf Seitz wrote:
> As far as I understand, a trait declared as "protected[mypackage] trait MyTrait" should
> only be accessible from inside the "mypackage" package.
> However, this is not at all the case. The code in this gist [0] compiles and runs fine.
>
> Is there a misunderstanding on my part or is it a bug/regression?

but it is closed a long time ago (but it shows there is a precedence on my crash...)

I see no other related issue (at least in the open ones), so I might open one, unless you
want to do it yourself, Gerolf.

Side note: if I change protected[d] to private[d], I get the compiler to throw an error...
(as it should)
If I interpret correctly the pins1ed book, protected[x] and private[x] are the same thing,
no? ("All qualifiers can also be applied to protected, with the same meaning as private."
or do I misinterpret this sentence?)