From: Roedy Green on
On Mon, 22 Feb 2010 20:33:06 -0800 (PST), Marc van Dongen
<dongen(a)cs.ucc.ie> wrote, quoted or indirectly quoted someone who said
:

>
>
>I know what the class method values( ) of enum classes is for, but
>don't seem to
>be able to find the API in the API documentation on
>http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Enum.html,
>
>I'd appreciate it if somebody could let me know where to find it.
>
>Thanks in advance for your help.

values() and valueOf(String) are generated methods. You won't find
them in any Sun class to be JavaDoced. They are discussed in the JLS.

I explain how they work at http://mindprod.com/jgloss/enum.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

Imagine an architect who would never admit to making sketches, blueprints or erecting scaffolds. In his view, the finished building speaks for itself. How could a young architect learn from such a man? Mathematicians traditionally refuse ever to disclose the intuitions that lead them to a conjecture, or the empirical tests to see if it were likely true, or the initial proofs. They are like chefs who refuse to disclose their recipes, ingredients or techniques.
From: Marc van Dongen on
On Feb 24, 12:21 am, Roedy Green <see_webs...(a)mindprod.com.invalid>
wrote:

> values() and valueOf(String) are generated methods.  You won't find
> them in any Sun class to be JavaDoced. They are discussed in the JLS.
>
> I explain how  they work at http://mindprod.com/jgloss/enum.html

Thanks Roedy, I knew that this method is generated. What I didn't know
was
that documentation was generated for the method in the new enum class.
Thanks to John B. Matthews for providing an example.

Regards,


Marc van Dongen
From: Patricia Shanahan on
markspace wrote:
> Tom Anderson wrote:
>> On Mon, 22 Feb 2010, markspace wrote:
>>
>>> In my opinion, the Java doc is defective for not mentioning these
>>> methods. It should copy-and-paste the above section into the Java doc
>>> for the Enum class, so that the information is ready-to-hand for
>>> anyone looking at the Enum methods.
>>
>> If you make javadoc for the enum itself, does that include the
>> synthetic methods? That seems like the right place for it to me -
>> Colours.values() is a method of the Colours type, not Enum.
>
>
> It still should be documented in the super type, imo, since the method
> is generated. Is see the distinction, but it would be very convenient
> to have it in the Java doc for Enum.
>

Even if the Java developers do not want to maintain the documentation in
two places, the Enum API documentation could be improved by adding a
reference to the relevant section in the JLS.

Patricia

From: John B. Matthews on
In article <b_SdncZsEM6vbRnWnZ2dnUVZ_v2dnZ2d(a)earthlink.com>,
Patricia Shanahan <pats(a)acm.org> wrote:

> markspace wrote:
> > Tom Anderson wrote:
> >> On Mon, 22 Feb 2010, markspace wrote:
> >>
> >>> In my opinion, the Java doc is defective for not mentioning these
> >>> methods. It should copy-and-paste the above section into the Java doc
> >>> for the Enum class, so that the information is ready-to-hand for
> >>> anyone looking at the Enum methods.
> >>
> >> If you make javadoc for the enum itself, does that include the
> >> synthetic methods? That seems like the right place for it to me -
> >> Colours.values() is a method of the Colours type, not Enum.
> >
> >
> > It still should be documented in the super type, imo, since the
> > method is generated. Is see the distinction, but it would be very
> > convenient to have it in the Java doc for Enum.
> >
>
> Even if the Java developers do not want to maintain the documentation
> in two places, the Enum API documentation could be improved by adding
> a reference to the relevant section in the JLS.

Such a reference is not without precedent:

$ find javadoc/jdk6 -name \*html \
| xargs -J % grep "Java Language Specification" % \
| wc -l
159

E.g. <http://java.sun.com/javase/6/docs/api/java/lang/String.html>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
From: Tom Anderson on
On Wed, 24 Feb 2010, John B. Matthews wrote:

> Such a reference is not without precedent:
>
> $ find javadoc/jdk6 -name \*html \
> | xargs -J % grep "Java Language Specification" % \
> | wc -l
> 159

Which xargs has a -J? Solaris or something?

tom

--
Hesgadin. It was in two parts - both of them silent. I remember this map
came with a letter accusing me of stealing eggs. I had never understood
the relationship of the map to the accusation. I still don't, but I'm
grateful for the map.