Eamonn McManus eamonn at mcmanus.net
Sat Aug 17 05:28:42 UTC 2013

The valueOf method in Enum subclasses is static, so Enum itself can't
usefully declare it. But the description of the Enum class could say
in text what the generated methods are, rather than referring the
reader to the JLS without even a link. If you forget what the methods
are you can always look in any enum, such as Thread.State
but you shouldn't have to.


2013/8/16 Nick Williams <nicholas+openjdk at nicholaswilliams.net>:
> That method doesn't exist in the actual java.lang.Enum base class. It gets generated automatically when the enum is compiled and is part of the compiled enum class, not part of the Enum base class.
> With that said, I don't disagree that it could use some documentation. I've often wondered why java.lang.Enum didn't have the following method definition:
> public abstract E valueOf(String name);
> That is essentially the method that all compiled enums implement, it's just not actually specified as an abstract method on the base class. If it were, then there could be JavaDoc for it.
> Nick
> On Aug 16, 2013, at 11:30 PM, Paul Benedict wrote:
>> I noticed this method is not listed in the Javadocs for 5/6/7/8 but it's
>> part of every enum. Is this an oversight or is there a good reason why it's
>> not documented?
>> --
>> Cheers,
>> Paul

More information about the core-libs-dev mailing list