Does Java not support Covariant Return Types on Enums?
Enum constants are fields, not types. The return type is covariant, but the types of the enumerated constants are anonymous classes. For this reason, the most specific static type for the value returned by getDoor()
in your example will be that of Door
.