• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Simple Javadoc Question

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At least I hope its simple. Lets suppose I have a class Class1 that has a method called Method1(). It has a reference to Class2, that has a method called Method2().

Method1 is simple:



This type of situation occasionally crops up in my code where a method simply calls a method from another class. Is there a way to link the javadoc comments for Method1 to Method2 so that if I change the javadoc for Method2 because maybe I add or remove a parameter the changes are automatically reflected in the javadoc for Method1?

I've looked around on Google, but apparently I'm just not good with search terms because I found nothing useful.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You *could* use a @see annotation in the "containing" JavaDoc that points to the method it calls, but ew: at what point would you stop doing that? I don't see any reason to document *other* methods in the documentation for methods that call it.
 
Marshal
Posts: 76447
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There might be a reason to document that. If you extend that class, it may not be possible to override that method without knowing its details. So you would say "this implementation calls the foo method on the Bar class". It is described a lot better in Effective Java by Joshua Bloch in the chapter called "document for extension or prohibit it."
 
reply
    Bookmark Topic Watch Topic
  • New Topic