Enum.valueOf(String)

Paul Benedict pbenedict at apache.org
Mon Aug 19 14:23:57 UTC 2013


I have been working with classes that don't have javadoc attachments. The
problem was I couldn't find the method in the source nor was the method
part of the Enum class. So where did it materialize from? Now I know the
answer: the compiler generates it.

I really think this knowledge should be added to the Enum javadoc class. I
had to go on quite a goose hunt to find this fact.

Paul


On Mon, Aug 19, 2013 at 3:32 AM, Alan Bateman <Alan.Bateman at oracle.com>wrote:

> On 18/08/2013 05:07, Paul Benedict wrote:
>
>> I think the generated method needs to be listed in the class javadoc at
>> least. I presume it throws an exception too (like the other valueOf) if
>> the
>> String can't be resolved to a constant, but no user is going to discover
>> this fact through the documentation.
>>
>>  Have you checked the generated avadoc for your enum? The valueOf(String)
> should be there and specified to throw IAE or NPE.
>
> -Alan
>
>
>


-- 
Cheers,
Paul



More information about the core-libs-dev mailing list