Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of the Java's Enum declaration?

Tags:

java

generics

Surfing on the source code of Java, I found the following declaration:

public abstract class Enum<E extends Enum<E>>

How should it be interpreted? I'm stuck with it...

Thank you.

like image 920
ATorras Avatar asked Nov 05 '22 19:11

ATorras


1 Answers

You're not alone. Ken Arnold had this to say:

Or, to show the same point in brief, consider this: Enum is actually a generic class defined as Enum<T extends Enum<T>>. You figure it out. We gave up trying to explain it.

(from the blog entry Generics Considered Harmful)

like image 138
Brian Agnew Avatar answered Nov 12 '22 21:11

Brian Agnew