Bug 546706 - [code mining] Parameter name annotations incorrectly in-lined on multi-line invocations
Summary: [code mining] Parameter name annotations incorrectly in-lined on multi-line i...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.12   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.12 M3   Edit
Assignee: Mickael Istria CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 547779
  Show dependency tree
 
Reported: 2019-04-24 12:14 EDT by Roland Grunberg CLA
Modified: 2019-05-30 06:28 EDT (History)
3 users (show)

See Also:


Attachments
Parameter Annotations Incorrectly Drawn (36.83 KB, image/png)
2019-04-24 12:16 EDT, Roland Grunberg CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Grunberg CLA 2019-04-24 12:14:20 EDT
Given the following snippet, multiple "input" annotations will be generated for each line of the asList() expression. Furthermore the 'val' annotation doesn't seem calculated correctly in this case.

package test;

import java.util.Arrays;
import java.util.List;

public class Test {

	public void test () {
		foo(Arrays.asList(
				"one", "two", "three",
				"four", "five", "six",
				"seven", "eight", "nine"), 0);
	}

	public void foo (List<String> input, int val) {
	}

}
Comment 1 Roland Grunberg CLA 2019-04-24 12:16:06 EDT
Created attachment 278381 [details]
Parameter Annotations Incorrectly Drawn
Comment 2 Mickael Istria CLA 2019-04-24 12:20:10 EDT
Thanks for the report.
I'll try to take care of it soon as I plan to spend some time in May on codeminings in general; but I'm currently working on higher priority stuff on m2e and Corrosion. So if anyone feels interested in working on it before I start, it'd be welcome ;)
Note that there are probably 2 distinct issues here: erroneous code mining content (the `input` repeated on multiple lines) which is probably an issue in JDT code mining provider, and a drawing issue that's on Platform Text.
Comment 3 Mickael Istria CLA 2019-04-29 04:59:52 EDT
Simpler case would be

  Math.max(System.currentTimeMillis(
     ), 0);
Comment 4 Angelo ZERR CLA 2019-04-29 05:06:30 EDT
I suspect the main problem comes from the draw of inlined annotation on the right of the previous character (before it was on the left of the next character if I remember). See https://github.com/eclipse/eclipse.platform.text/commit/f5879917fb106cf8bdc6a94a42805c6e4226a30b#diff-87e8a0bc35895d0b8a27e21c6605f14bR229
Comment 5 Mickael Istria CLA 2019-04-29 05:08:19 EDT
(In reply to Angelo ZERR from comment #4)
> I suspect the main problem comes from the draw of inlined annotation on the
> right of the previous character (before it was on the left of the next
> character if I remember). See
> https://github.com/eclipse/eclipse.platform.text/commit/
> f5879917fb106cf8bdc6a94a42805c6e4226a30b#diff-
> 87e8a0bc35895d0b8a27e21c6605f14bR229

Yes, I also think so.
I'm trying to write a failing test first for JDT, then will try to write a failing test for Platform.Text and then a fix.
Comment 6 Eclipse Genie CLA 2019-04-29 05:58:05 EDT
New Gerrit change created: https://git.eclipse.org/r/141314
Comment 7 Eclipse Genie CLA 2019-04-29 10:51:31 EDT
New Gerrit change created: https://git.eclipse.org/r/141343
Comment 9 Dani Megert CLA 2019-04-30 05:08:44 EDT
(In reply to Eclipse Genie from comment #8)
> Gerrit change https://git.eclipse.org/r/141343 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=b26b8782569616fcace8dcbd47a61c13ae694513
> 
This introduced a compile warning in the official build.

Fixed with https://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=1a653bc834f51a8a5a28fe89bd5ea0ac42c29a46