mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-18 04:21:24 +07:00
constructor reference: don't ignore constructor parameters during method reference inference (IDEA-185578)
GitOrigin-RevId: e836468e05db28157713e9edd3c70382f8ecdebc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
89bb3c6fda
commit
91f7445298
@@ -0,0 +1,12 @@
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
class Foo<T> {
|
||||
public Foo(Predicate<T> p) {
|
||||
}
|
||||
|
||||
void m(Predicate<String> p){
|
||||
new Foo<>(p == null ? null : acc -> p.test<error descr="'test(java.lang.String)' in 'java.util.function.Predicate' cannot be applied to '(java.lang.Object)'">(acc)</error>);
|
||||
new Foo<>(acc -> p.test<error descr="'test(java.lang.String)' in 'java.util.function.Predicate' cannot be applied to '(java.lang.Object)'">(acc)</error>);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ class MyTest {
|
||||
public <T> void from(Collection<T> elements) { }
|
||||
|
||||
public void foo(final Stream<String> artifactStream) {
|
||||
from(artifactStream.collect(Collectors.toCollection(<error descr="Bad return type in method reference: cannot convert java.util.TreeSet<java.lang.String> to C">TreeSet<String>::new</error>)));
|
||||
from<error descr="Ambiguous method call: both 'MyTest.from(Page<String>)' and 'MyTest.from(Collection<String>)' match">(artifactStream.collect(Collectors.toCollection(TreeSet<String>::new)))</error>;
|
||||
}
|
||||
|
||||
interface Page<T> extends Iterable<T> {}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
interface I {
|
||||
void f();
|
||||
}
|
||||
|
||||
class B implements I {
|
||||
@Override
|
||||
public void f() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class MyTest {
|
||||
void m(I i) {}
|
||||
|
||||
void n(int ik) {
|
||||
m(ik > 0 ? () -> {} : new B());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user