Community
Participate
Working Groups
20050131 In the following code, has the method no return type (or a constructor the wrong name) Look at the extended range of the method name: It includes the Javadoc comment. class A { /** * */ d() { } }
Looking at the specs it doesn't seem to be wrong to return the preceeding comment.
The Javadoc comment is an exception as it is repesented by an own node. The extended ranges must not overlap with any other node range or even extended node ranges.
note that this bug is not urgent, I have a workaround for it
If time permit
Fixed and released in HEAD. Javadoc comment is not set when method and field declaration binding (ie. dom one) is null. [jdt-core-internal] Changes done ASTConverter convert(AbstractMethodDeclaration) and convertToFieldDeclaration(FieldDeclaration) methods. Test case added in ASTConverterJavadocTests
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD-20050512.
Reopen. This doesn't seem to be a problem. The javadoc should always be set.
Martin, I checked the current and the old behavior and I don't see why the javadoc has been removed. With or without the javadoc, the extended range should include the javadoc comment. The only difference between the current behavior and the old behavior is that now the javadoc node is null when bindings are requested. It has no impact on the extended range. In fact the actual range is wrong. It includes the javadoc without initializing the javadoc node. So the comment is part of the method declaration range or extended range without being part of the tree as the method declaration javadoc node. This looks wrong. Could you please describe what you meant in your comment 2? I don't see any overlapping in my testing.
I also find the fix to remove the Javadoc node a bit radical (sorry that I didn't protest when it got fixed, I must have missed it). My bug was about the extended source ranges. By design, an extended source range must not overlap with any other node. In this case, the range for the name node (SimpleName) was including the Javadoc node. The correct fix would be to keep the Javadoc node as it was before, but fixing the extended source range of the name node. (e.g. you could say that the extended source range is equals to the normal range when you have this error)
Olivier, This is a bug in DefaultCommentMapper => I'll fix it
Created attachment 54077 [details] Proposed patch
Released for 3.3 M4 in HEAD stream.
Verified for 3.3M4 with I20061212-0010.