Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329423 - Java Discoverer : misplaced comments between blank lines
Summary: Java Discoverer : misplaced comments between blank lines
Status: CLOSED FIXED
Alias: None
Product: MoDisco
Classification: Modeling
Component: Technologies (show other bugs)
Version: 0.9.0   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 0.9.0 M3   Edit
Assignee: Fabien Giquel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-04 06:35 EDT by Fabien Giquel CLA
Modified: 2011-01-11 05:16 EST (History)
3 users (show)

See Also:
fabien.giquel: indigo+
fabien.giquel: review? (barbier.gabriel)


Attachments
A proposed patch (1.03 KB, patch)
2010-11-04 10:14 EDT, Fabien Giquel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.