[enhanced-enums]: Enhanced enums failure with raw types?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Sep 15 17:10:35 UTC 2017

On 12/09/17 11:34, B. Blaser wrote:
> I agree with you, but this works with a warning (with the latest
> "enhanced enums" version - I've not tried with the JDK 9).
> It seems the inference occurs only on the actual argument (E = G) and
> then an unchecked cast is made from "EnumSet<G>" to
> "EnumSet<G<Object>>" when returning a value, producing a warning.
> (Or the inverse - I've not verified - inference from the return type
> (E = G<Object>) and unchecked cast from "Class<G>" to
> "Class<G<Object>>" when passing the actual argument)
> Is this a bug?
This is a known non-confromance issue - see:


In other words, the code passes because javac does an unchecked 
subtyping between G and G<Object> (this check would fail if standard 
subtyping were used, as mandated by the spec).


More information about the amber-dev mailing list