Acces to private field from nested class when the type of reference is a generic type variable with upper bound of outer class
maurizio cimadamore
maurizio.cimadamore at oracle.com
Fri Oct 7 14:15:13 PDT 2011
On 07/10/2011 21:57, Peter Levart wrote:
> On Friday, October 07, 2011 10:45:38 PM Peter Levart wrote:
>> The same goes for types that are expressed as type-variables. They are a
>> conjunction of all possible types that match the bounds (if any). The
>> language is sound if it does not "prefer" just one of them.
> Pardom my ignorance. I'm no expert in type systems, but if the type is defined as a set
> containing members (possible values) then a type-variable is a "disjunction" of all possible
> types that match is't bounds (not "conjunction").
An intersection type A1, A2 ... An is defined as the most general type
that is a subtype of both A1, A2 ... An.
Since it is a subtype of all its components, it follows it should
contain the members of the 'union' of the components. However, since
it's a subtype, private members in supertypes are not inherithed.
Maurizio
> Correct me if I'm wrong.
>
> Peter
>
More information about the compiler-dev
mailing list