Bug 484963 - [1.8][compiler][inference] Incorrectly inferred method type arguments when varargs call arguments are inferred, too
Summary: [1.8][compiler][inference] Incorrectly inferred method type arguments when va...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5.1   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-29 04:54 EST by Piotr Findeisen CLA
Modified: 2022-08-16 12:25 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 Piotr Findeisen CLA 2015-12-29 04:54:10 EST
The following code

* compiles without a warning using javac 1.8.0_66
* gives compilation error under Eclipse Mars.1 (project compat set to 1.8)

    Type mismatch: cannot convert
    from List<Predicate<? extends Object>>
    to List<? extends Predicate<? super String>>

------------------------
import java.util.List;
import java.util.function.Predicate;

public class Inferrr {
	public List<? extends Predicate<? super String>> getStringAcceptingPredicates() {
		return java.util.Arrays.asList(
				eq("s"),
				eq(new Object())
		);
	}

	private <T> Predicate<T> eq(T compared) {
		return s -> compared.equals(s);
	}
}
------------------------
Comment 1 Stephan Herrmann CLA 2017-04-01 13:48:43 EDT
It seems we are not correctly passing a target type into inference for the 2nd varargs argument.
Comment 2 Manoj N Palat CLA 2018-05-16 01:30:32 EDT
Bulk move out of 4.8
Comment 3 Mat Gessel CLA 2019-11-02 18:35:42 EDT
Unable to reproduce in JDT 3.18.100.v20190916-1045 ; tried ecj 1.8, 12.
Comment 4 Eclipse Genie CLA 2022-08-16 12:25:45 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.

If you have further information on the current state of the bug, please add it. 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.