Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329423

Summary: Java Discoverer : misplaced comments between blank lines
Product: [Modeling] MoDisco Reporter: Fabien Giquel <fabien.giquel>
Component: TechnologiesAssignee: Fabien Giquel <fabien.giquel>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: barbier.gabriel, hugo.bruneliere, modisco.web-inbox
Version: 0.9.0Flags: fabien.giquel: indigo+
fabien.giquel: review? (barbier.gabriel)
Target Milestone: 0.9.0 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
A proposed patch none

Description Fabien Giquel CLA 2010-11-04 06:35:17 EDT
Discovering this part of code leads up to to a misplaced comment attachment in Java model : comment is attached to the block rather than to the last statement.

	public static void main(String[] args) {
		int i = 1;
		
		/* a comment */
		
		int j = 0;
		}
Comment 1 Fabien Giquel CLA 2010-11-04 10:14:11 EDT
Created attachment 182370 [details]
A proposed patch
Comment 2 Fabien Giquel CLA 2010-11-04 10:20:24 EDT
Hi Gabriel,

i need your opinion about the patch i propose here to resolve this case, since it deals with recent modifications in "CommentsManager.jdtLocationSearch()". I removed some "inside comments" process but i need to know if this recent process was responding to some specific use case not well managed in "CommentsManager.alternateLocationSearch()". Test Junits are ok.
Comment 3 Fabien Giquel CLA 2010-11-04 10:58:47 EDT
I have commited some junit test associated to this bug, without adding it in AllTests.java until an effective fix.
Comment 4 Gabriel BARBIER CLA 2010-11-08 04:07:57 EST
(In reply to comment #2)
Hello Fabien,

Perhaps I've not made the work for every block, but for comments inside a type, they are processed a second time using the alternative algorithm. It is to deal with the example you have provided (blank lines or white-spaces in general between a comment and a statement/expression/field/methods/...).

So a solution could be to not process at all "inside comments" using the first algorithm, and use only the alternative algorithm.

Regards
Gabriel
Comment 5 Fabien Giquel CLA 2010-11-08 13:45:56 EST
ok, the patch has been commited into SVN (revision 3584).
Comment 6 Hugo Bruneliere CLA 2011-01-11 05:16:55 EST
Bug fixed via a patch.