2

In Eclipse, when you hover on an element, only the Javadoc shows, and the element's (unconstrained) signature.

Suppose I have a class X <T extends Object> {}. If I use Eclipse's Javadoc generator, I get:

/**
 * @param <T>
 */ 

The rendered Javadoc looks like this. Note the lack of type constraint information.

    com.domain.X<T>        Parameters:           <T>

Is there any way to show the generic type constraints from the Javadoc viewer in Eclipse?

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
  • 1
    Why would you like to document something that is self explanatory in its declaration itself? – Edwin Dalorzo Mar 28 '12 at 13:54
  • 1
    @edalorzo In Eclipse, when you hover on an element, only the Javadoc shows, and the element's (unconstrained) signature. I'd like to see it in the Javadoc. – Jeff Axelrod Mar 28 '12 at 13:59

2 Answers2

2

I entered an Eclipse bug/enhancement to address this issue. Incredibly, Markus Keller actually implemented/fixed this within 3-4 hours of the submission!

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
0

The class's body already says that T extends Object, you don't need it in the javadoc.

When documenting things (comments in code or javadoc etc.), follow these 2 rules:

  • Don't repeat yourself. If you don't follow this, then it will be a lot harder to keep comments and code in sync.
  • Don't document what's obvious. The readers of your code know the language. Instead of explaining for example that you did a cast, explain WHY you did a cast.
Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
Radu Murzea
  • 10,724
  • 10
  • 47
  • 69
  • It seems that this is an irritating limitation of Eclipse's Javadoc implementation. I agree that I shouldn't have to manually document it in my Javadoc just because Eclipse doesn't add this information to the displayed Javadoc. – Jeff Axelrod Mar 28 '12 at 14:04
  • I've rewritten the question appropriately, so please feel free to delete your answer. – Jeff Axelrod Mar 28 '12 at 14:17