Why in java enum is declared as Enum<E extends Enum<E>>

Posted by atamur on Stack Overflow See other posts from Stack Overflow or by atamur
Published on 2010-06-17T12:55:40Z Indexed on 2010/06/17 13:23 UTC
Read the original article Hit count: 393

Filed under:
|

if language designers were to use simply Enum<E extends Enum> how would that affect the language?

The only difference now would be that someone coud write

A extends Enum<B>

but since it is not allowed in java to extend enums that would be still illegal. I was also thinking about someone supplying jvm a bytecode that defines smth as extending an enum - but generics can't affect that as they all are erased.

So what is the whole point of such declaration?

Thank you!

© Stack Overflow or respective owner

Related posts about java

Related posts about enums