Bug 51104

Summary: Comments are not recorded when inside a method body
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Test case none

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