Community
Participate
Working Groups
20040318 In the following code, the extended range of class A includes the Javadoc of class Test1. /** */ class A{ }/** */ class Test1{ }
Fixed. Also similar problems, but different due to new line after/before trailing comment, were fixed: public class B { public int bar() { int x=0; if (true) { x=1; } else { x=2; } return x; } /** * This comment should not be attached to previous method body! * @return int */ public int foo() { return 1; } } public class C { public int bar() { int x=0; if (true) { x=1; } else { x=2; } return x; } /** * This comment should not be attached to previous method body! * @return int */ public int foo() { return 1; } } And also: public class D { /** * Javadoc comment */// Line comment boolean foo() { return false; } } In this case return_type 'boolean' start position was wrongly extended to line comment. For class A, B and C, the javadoc was both attached to body of method bar and to method foo(). Fixed by verifying that trailing comment was not already a javadoc of a body declaration (here a method declaration). For class D, we're wrongly looking if the start position of token preceeding trailing comment was on the same line. It was the end position that we must verify and not start position... [jdt-core-internal] All changes done in DefaultCommentMapper methods storeLeading/TrailingComments. Test case added in jdt.core.test.dom.ASTConvertJavadocTests
With this change refactoring test SurroundWithTests.testOneLine() is failing. Undid the change for now. Reopening to investigate.
That's a bug in our test. We change it to pass with the wrong behavior. It's now correct again.
Fix released again in HEAD.
Verified in build I200403250800.