Enum.valueOf(String)

Nick Williams nicholas+openjdk at nicholaswilliams.net
Sat Aug 17 04:54:36 UTC 2013


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