Oh, yea. Duh. I completely forgot about it being static, which of course it would HAVE to be to be useful. Silly me.
Maybe there's a new language feature in there somewhere. Abstract static methods? ;-) Still, yes. I would recommend that the JavaDoc for the Enum class list the signature and usage of any/all generated methods. Nick On Aug 17, 2013, at 12:28 AM, Eamonn McManus wrote: > 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 > <http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html>, > but you shouldn't have to. > > Éamonn > > > 2013/8/16 Nick Williams <nicholas+open...@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 >>