Bug 5295

Summary: Segmented view misses field comment
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P5    
Version: 2.0   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Jerome Lanneluc CLA 2001-10-26 11:51:48 EDT
Build 20011025

1. Create the following CU:
X.java
------
public class X {
	String s1 = "s1"; //comment for s1
}

2. Make sure that 'Show Source of Selected Element Only' is selected
3. In the Outline, select field 's1'
Observe: The comment doesn't appear near the field declaration.
Comment 1 Dirk Baeumer CLA 2002-01-08 09:10:57 EST
The positions provided by the Java Model don't include line comments. So the 
editor doesn't know about the trailing comment. There are two possible 
solutions:

- the editor parses the CU using the (internal) scanner
- the java model provides corresponding positions.

Opt to postpone > 2.0
Comment 2 Dirk Baeumer CLA 2002-07-25 13:45:11 EDT
IMO the Java model should provide more support for comments to solve this. The 
UI should not start to parse the code and search for comments.

Moving to Core for commenting
Comment 3 Philipe Mulet CLA 2002-07-26 13:04:50 EDT
I would expect the comment behind to be part of the element. Please investigate.
Comment 4 Olivier Thomann CLA 2002-07-26 13:11:29 EDT
There is no good solution for including comments in the nodes. This is why the 
setLeadingComment(...) is not implemented. Only the javadoc comments are 
properly handled now.
This is a more generic problem. We need to find out how to map the comments and 
the DOM/AST tree. When we get something consistent, then we can fix this PR.
A trailing comment can also be seen as the leading comment of the next 
statement or expression.
For now I don't see how to manage the comments and the DOM/AST tree.
Comment 5 Olivier Thomann CLA 2002-12-04 17:30:13 EST
This bug is due to the fact that the SourceElementParser doesn't provide the
declaration source end for a field. The fix is simple and requires to pass an
extra argument in exitField.
Comment 6 Olivier Thomann CLA 2002-12-05 12:16:20 EST
Fixed and released in 2.1 stream. The end of the field is not its declaration
source end which includes the trailing comment.
Comment 7 Olivier Thomann CLA 2002-12-05 12:16:40 EST
Change milestone.
Comment 8 David Audel CLA 2002-12-18 07:09:54 EST
Verified.