Community
Participate
Working Groups
Using 3.1 M6 Commpiler does not warn for missing tags as soon as {@inheritedDoc} tag is present in Javadoc comment. This is not correct as method should really override one to make this tag working. In following test case: public class X { /** * Static method * @param str * @return int * @throws NumberFormatException */ static int foo(String str) throws NumberFormatException{ return Integer.parseInt(str); } } public class Y extends X { /** * Static method * {@inheritDoc} */ static int foo(String str) throws NumberFormatException{ return Integer.parseInt(str); } /** * Not overridden method * {@inheritDoc} */ int bar(String str) throws NumberFormatException{ return Integer.parseInt(str); } } javadoc.exe produces 4 warnings: Y.java:13: warning - @inheritDoc used but bar(String) does not override or implement any method. Y.java:6: warning - @inheritDoc used but foo(String) does not override or implement any method. Y.java:6: warning - @inheritDoc used but foo(String) does not override or implement any method. Y.java:13: warning - @inheritDoc used but bar(String) does not override or implement any method.
Fixed. Now compiler flags these unnecessary {@inheritDoc} tags as unexpected. [jdt-core-internal] Changes done in: - Javadoc: change inherited flag to inheritedPositions + method resolve(MethodScope) - AbstractCommentParser: change inherited flag to inheritedPositions - JavadocParser: methods parseTag(int) + updateDocComment() - DocCommentParser: method parseTag(int) Test cases modified and added in JavadocBugsTest
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.