Bug 90302 - [javadoc] {@inheritedDoc} should be inactive for non-overridden method
Summary: [javadoc] {@inheritedDoc} should be inactive for non-overridden method
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-05 10:52 EDT by Frederic Fusier CLA
Modified: 2005-05-12 06:49 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2005-04-05 10:52:34 EDT
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.
Comment 1 Frederic Fusier CLA 2005-04-11 10:53:42 EDT
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
Comment 2 Maxime Daniel CLA 2005-05-12 06:23:06 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.