Initial proof of concept for implementation of -Xlint:hiddenclass
Rémi Forax
forax at univ-mlv.fr
Sat Mar 17 02:06:14 PDT 2012
On 03/17/2012 03:24 AM, Jonathan Gibbons wrote:
> Dan,
>
> I think your interpretation is arguably over-zealous.
>
> The exact text, from the current edition of JLS is
>
>> If and only if packages are stored in a file system (§7.2), the host
>> system may choose to enforce the restriction that it is a
>> compile-time error if a type is not found in a file under a name
>> composed of the type name plus an extension (such as .java or .jav)
>> if either of the following is true:
>>
>> The type is referred to by code in other compilation units of the
>> package in which the type is declared.
>>
>> The type is declared public (and therefore is potentially accessible
>> from code in other packages).
>
> The host system is given a /choice/ of whether to enforce a
> restriction, so you can't say it is unconditionally "_not_ legal".
>
> Nevertheless, this is an interesting part of the spec, and I agree we
> should move towards enforcing it.
>
> We need a better name than "hidden class", since hiding is a term that
> already exists in JLS, and can already apply to classes, and is not
> related to the conditions being described here.
>
> -- Jon
concealed class ?
Rémi
More information about the compiler-dev
mailing list