Community
Participate
Working Groups
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...
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.
Verified.