[enhanced-enums]: Enhanced enums failure with raw types?
bsrbnd at gmail.com
Mon Sep 18 21:33:06 UTC 2017
On 18 September 2017 at 22:09, Maurizio Cimadamore
<maurizio.cimadamore at oracle.com> wrote:
> You keep talking about 126.96.36.199 - but I don't think that's the place where
> the action happens. You just need 18.5.1 e.g. inference in overload
> resolution. The sole constraint (coming from the actual) that Class<G> <:
> Class<E> is enough to create problems. We are not even looking at the target
> type here - concluding that G = E, and then verifying that G satisfies E's
> declared bound (which you have to do, as 18.5.1 does incorporation too) is
> enough to stress the dependency on unchecked conversion during
> I don't see anything in incorporation that gives special unchecked treatment
> to a check like this:
> G <: Enum<E>
> The only thing I can find is this, in section 18.2.3 (subtyping constraints)
> - given S <: T...
> "If T is a parameterized class or interface type, or an inner class type of
> a parameterized class or interface type (directly or indirectly), let A1,
> ..., An be the type arguments of T. Among the supertypes of S, a
> corresponding class or interface type is identified, with type arguments B1,
> ..., Bn. If no such type exists, the constraint reduces to false. Otherwise,
> the constraint reduces to the following new constraints: for all i (1 ≤ i ≤
> n), ‹Bi <= Ai›."
> Now, since S is raw here, there's no supertype of S for which we can derive
> the type-arguments that should be used to set up the equality constraints.
> So I think that means incorporation returns false here (and the method is
> then considered not applicable, as per 18.5.1).
That's the point I didn't understand in your previous explanations.
This is clear enough, you're definitively right (and I see the
connection to JDK-8026527, too).
More information about the amber-dev