Bug 84049 - [javadoc][dom] Extended ranges wrong for method name without return type
Summary: [javadoc][dom] Extended ranges wrong for method name without return type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-31 10:52 EST by Martin Aeschlimann CLA
Modified: 2006-12-12 06:40 EST (History)
3 users (show)

See Also:


Attachments
Proposed patch (3.29 KB, patch)
2006-11-17 11:13 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2005-01-31 10:52:28 EST
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() {   
  }
}
Comment 1 Olivier Thomann CLA 2005-01-31 11:36:46 EST
Looking at the specs it doesn't seem to be wrong to return the preceeding comment.
Comment 2 Martin Aeschlimann CLA 2005-01-31 11:43:17 EST
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.
Comment 3 Martin Aeschlimann CLA 2005-01-31 11:46:59 EST
note that this bug is not urgent, I have a workaround for it
Comment 4 Frederic Fusier CLA 2005-03-14 15:00:03 EST
If time permit
Comment 5 Frederic Fusier CLA 2005-04-25 17:07:00 EDT
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
Comment 6 Maxime Daniel CLA 2005-05-12 13:41:20 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD-20050512.
Comment 7 Olivier Thomann CLA 2005-09-06 11:57:40 EDT
Reopen. This doesn't seem to be a problem.
The javadoc should always be set.
Comment 8 Olivier Thomann CLA 2005-09-06 13:34:09 EDT
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.

Comment 9 Martin Aeschlimann CLA 2005-09-11 15:19:41 EDT
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)
Comment 10 Frederic Fusier CLA 2005-09-12 04:30:21 EDT
Olivier,
This is a bug in DefaultCommentMapper => I'll fix it
Comment 11 Frederic Fusier CLA 2006-11-17 11:13:05 EST
Created attachment 54077 [details]
Proposed patch
Comment 12 Frederic Fusier CLA 2006-11-17 11:20:37 EST
Released for 3.3 M4 in HEAD stream.
Comment 13 David Audel CLA 2006-12-12 06:40:09 EST
Verified for 3.3M4 with I20061212-0010.