views:

104

answers:

3

Every time i used the @inheritDoc tag in javadoc, I see the following warning (example):

@inheritDoc used but getCount() does not override or implement any method.

Does anybody know how to avoid that? I'm sure that the methods implement/override another method, because I also set the @override tag, and Eclipse doesn't complain about that.

I had a similair warning concering @link where the reference could'nt be found. This is solved by using absolute identifiers (e.g. android.content.Intent instead of Intent). Is there any similar solution to this problem?

+4  A: 

That's a bit strange! Things I'd look for:

  • Check that the getCount() method really overrides a method in some ancestor class. (I know ... @Override ... but check anyway!)

  • Check that the method that you are overriding actually has some javadoc.

  • Check that the class containing the method you are overriding is on the source code path. If its not, then the javadoc utility won't be able to extract the relevant material from the parent class source file to include in the javadoc for the child method.

(And bugs in the javadoc utility is another possible cause ...)

EDIT

The javadoc sourcepath is set using the command's "-sourcepath" option, as described here. Basically, you need to tell the javadoc utility where the ZIP file containing the source code of the android classes is.

Stephen C
1. checked. it really overrides something2. checked. there is javadoc available for the method in the superclass3. how do i actually check this?
Roflcoptr
@User Unknown: See the answer here -- http://stackoverflow.com/questions/1243063/inheritdoc-not-inheriting-superclass-javadoc-in-eclipse
Segphault
Thanks i read it and don't fully understand it. I left a comment there.
Roflcoptr
+1  A: 

There appears to be bugs in several versions of java which would cause these errors. So I think the first thing is to upgrade to the latest version of Java and try again.

I don't think this problem is related to your @link problem. The @link problem is expected when you reference a class that isn't actually referenced anywhere in code in the class unless you use a full package reference to the class being referenced.

Erick Robertson
I also tried this. No improvements :(
Roflcoptr
+2  A: 

If the superclass is a class in a third-party library, you need the source code in order for the @inheritDoc annotation to know where to find it.

For example, if you're trying to inherit docs from a class/interface in the J2SE libraries, you can do this by unzipping the src.zip file that ships with the SDK, and adding its path to -sourcepath. When javadoc runs on your code, it will load the doc comments from those source files as needed.

iandisme