Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 485066 - [1.7-][compiler] eclipse reports ambiguous method error, code compiles fine with javac
Summary: [1.7-][compiler] eclipse reports ambiguous method error, code compiles fine w...
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-01 04:05 EST by Sasikanth Bharadwaj CLA
Modified: 2020-05-15 13:20 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sasikanth Bharadwaj CLA 2016-01-01 04:05:13 EST
Steps to reproduce

1. in the eclipse git repository view, clone the project (https://github.com/jenkinsci/git-plugin.git)
2. after the clone is complete, select the new repository in the Git Repositories view, right-click and select the "import maven projects..." menu
3. after the import is complete (it took several minutes on my system) right-click the project in the package explorer (or whatever view you prefer) and click the maven->update project menu.
4. when the update is complete, and the automatic project build completes, you will see two errors in the problems view on the /git/src/test/java/hudson/plugins/git/GitSCMTest.java module.

Reproducible on master.
Comment 1 Sasikanth Bharadwaj CLA 2016-01-01 04:07:36 EST
Shorter test case that can be pasted into PE. This code compiles fine at 1.8 but reports ambiguous method error at 1.7 and below

/----

public class Test {
	public static Project createProject() {
		return null;
	}
	public static void main(String[] args) {
		new TestCase().test(createProject()); // problem here
	}
}
class TestCase {
	<T extends Job> T test(T t){
		return null;
	}
	<P extends Item> P test(P p) {
		return null;
	}
}
interface Item {}
class AbstractItem implements Item {}
class Run<T extends Job<T,R>, R extends Run<T,R>> {
	
}
class Job<T extends Job<T,R>,R extends Run<T, R>> extends AbstractItem {}
class Build extends Run<Project, Build> {}
class Project extends Job<Project, Build> {}

/-----
Comment 2 Sasikanth Bharadwaj CLA 2016-01-01 04:12:38 EST
Initial analysis shows that msmb computation fails to pick one method over the other at 1.7 compliance. Prime suspect is the raw type Job in the method <T extends Job> T test(T t). Changing this to <T extends Job<?,?>> T test(T t) resolves the problem.
Comment 3 Eclipse Genie CLA 2020-05-15 13:20:58 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.