Bug 90302

Summary: [javadoc] {@inheritedDoc} should be inactive for non-overridden method
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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.