mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
method references: don't infer Object when no constraint exist for 'raw' reference (IDEA-171922)
This commit is contained in:
+4
@@ -252,6 +252,10 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
|
||||
LOG.assertTrue(paramTypes.length == signature.getParameterTypes().length, "expr: " + methodReferenceExpression + "; " +
|
||||
paramTypes.length + "; " +
|
||||
Arrays.toString(signature.getParameterTypes()));
|
||||
if (Arrays.deepEquals(signature.getParameterTypes(), paramTypes)) {
|
||||
return PsiSubstitutor.EMPTY;
|
||||
}
|
||||
|
||||
psiSubstitutor = helper.inferTypeArguments(PsiTypesUtil.filterUnusedTypeParameters(qContainingClass.getTypeParameters(), paramTypes),
|
||||
paramTypes,
|
||||
signature.getParameterTypes(),
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
class Foo<T extends Comparable<T>> {
|
||||
|
||||
public Foo(final Foo<T> tuple) { }
|
||||
|
||||
{
|
||||
List<Foo<T>> l = bar(Foo::new);
|
||||
}
|
||||
|
||||
public<U> List<U> bar(Function<Foo<T>, U> mapper) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -172,6 +172,7 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIncludeOnlyTypeParametersUsedInParameterTypesExcludeThoseUsedInReturnOnly() { doTest(); }
|
||||
public void testMethodREfToContainingMethodWithGenericParam() { doTest(); }
|
||||
public void testDistinguishCapturedWildcardsByDifferentParameters() throws Exception { doTest(); }
|
||||
public void testConstructorRefOnClassWithRecursiveTypeParameter() throws Exception { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
|
||||
Reference in New Issue
Block a user