Bug 51104 - Comments are not recorded when inside a method body
Summary: Comments are not recorded when inside a method body
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.0 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-03 11:02 EST by Olivier Thomann CLA
Modified: 2004-02-11 11:54 EST (History)
0 users

See Also:


Attachments
Test case (217 bytes, text/plain)
2004-02-03 11:03 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2004-02-03 11:02:09 EST
Using latest JDT/Core, I could not retrieve the right number of comments for a
compilation unit if the comments are inside a method body.
I will attach a test case.
Comment 1 Olivier Thomann CLA 2004-02-03 11:03:30 EST
Created attachment 7686 [details]
Test case

This compilation unit has three comments (one javadoc, one block comment and
one line comment).
Comment 2 Frederic Fusier CLA 2004-02-03 13:00:26 EST
Comments need also to be stored by scanner while jumping over method body in 
diet parse...
Comment 3 Frederic Fusier CLA 2004-02-04 14:24:01 EST
Fixed.
Now all comments are correctly recorded by scanner and parser.

[jdt-core internal]
1) jumpOverMethodBody method in Scanner has been refreshed from getNextToken 
implementation for comments scan.
2) endParse has been overridden in CommentRecorderParser instead of dietParse 
in order to store comments positions in compilation unit. This was necessary 
has for partial parse, dietParse was not called. In case of full parse, 
endParse is called twice => positions are only set once when null on 
compilation unit.
3) method buildCommentsTable has been added to ASTConverter to allow a set of 
this table while parsing partial nodes.

Test cases added in jtd.core.test.model.ASTConverterJavadocTest and also in 
ASTConverterTest2.
Comment 4 David Audel CLA 2004-02-11 11:54:04 EST
Verifeid for 3.0M7