Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 5
    "I have a property with an associated getter and setter (the property is not exposed directly)" Spoiler: your property is exposed directly, you've just obfuscated it. Commented Feb 17 at 15:15
  • 1
    Which ever option you go with, just please fight the temptation to document everything, when it leads to e.g. a Person.setName(String name) method to be documented with noise like "Sets the String name on this person" Commented Feb 19 at 18:25
  • You document the getter and the setter for the clients of your class. You document the private field for the maintainers of the class who care about the internals. One option is not to use javadoc for the latter. You state what is conceptually relevant or otherwise non-obvious, as appropriate in each context - if there is something to say. E.g., maybe the getter returns a copy of the underlying field. Don't just restate in English what any dev can understand from code; as in, don't write "Gets an instance of MyFoo" for MyFoo getFoo(). That's just busywork and noise; better to write nothing. Commented Feb 19 at 22:41