Bug 45737 - Unexpected Javadoc warnings when I rebuild my project
Summary: Unexpected Javadoc warnings when I rebuild my project
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-29 11:33 EST by Frederic Fusier CLA
Modified: 2003-11-21 06:28 EST (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 2003-10-29 11:33:26 EST
Build I20031023.
Need two classes to reproduce the problem:
public class X {
	void foo() {}
}
public class Y {
	void foo() {
		X x = new X() {
			/**
			 * Valid javadoc comment in anonymous class.
			 * @param str String
			 * @return int
			 */
			int bar(String str) {
				return 10;
			}
		};
		x.foo();
	}
}
Set compiler option 'Problems in Javadoc tags' to Warning.
No complain from compiler while editing and saving the 2 classes.
BUT... if I perform a rebuild project, then I got 2 warnings on return type 
(int) and argument (str) of method bar...
Comment 1 Frederic Fusier CLA 2003-10-31 11:10:09 EST
Problem comes that when several classes are compiled, there's first a diet 
parse of all classes, then a second pass to parse method bodies.
Parser scanner line ends array was not re-initialized during this second pass 
and kept the result of the last scan.
As AnnotationParser uses lineEnds to parse javadoc comments, it fails to find 
correctly the tags and wrongly complained.

Fixed by setting parser scanner line ends array with the compilation result 
line ends positions in method Parser.getMethodBodies(...).

Also verify senders of Scanner.setSource(char[]) to verify that there's no 
other potential problem => apply the same fix in MatchLocator.getMethodBodies
(...).

Test case 'testBug45737' added in AnnotationTestMixed.

Comment 2 David Audel CLA 2003-11-21 06:28:41 EST
Verified.