mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
skip warnings for constructor refs with varargs (IDEA-174074)
This commit is contained in:
@@ -245,7 +245,8 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm
|
||||
final PsiResolveHelper helper = JavaPsiFacade.getInstance(methodReferenceExpression.getProject()).getResolveHelper();
|
||||
final PsiType[] paramTypes =
|
||||
member instanceof PsiMethod ? ((PsiMethod)member).getSignature(PsiSubstitutor.EMPTY).getParameterTypes() : PsiType.EMPTY_ARRAY;
|
||||
LOG.assertTrue(paramTypes.length == signature.getParameterTypes().length, "expr: " + methodReferenceExpression + "; " +
|
||||
LOG.assertTrue(paramTypes.length == signature.getParameterTypes().length ||
|
||||
member instanceof PsiMethod && ((PsiMethod)member).isVarArgs(), "expr: " + methodReferenceExpression + "; " +
|
||||
paramTypes.length + "; " +
|
||||
Arrays.toString(signature.getParameterTypes()));
|
||||
if (Arrays.deepEquals(signature.getParameterTypes(), paramTypes)) {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
class Foo<H> {
|
||||
|
||||
private Foo(Foo s, Foo... ss) {}
|
||||
|
||||
{
|
||||
foo(Foo::new);
|
||||
}
|
||||
|
||||
private <T> void foo(final Function<Foo, T> param) { }
|
||||
}
|
||||
@@ -171,6 +171,7 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testNonExactMethodReferenceOnRawClassType() { doTest(); }
|
||||
public void testIncludeOnlyTypeParametersUsedInParameterTypesExcludeThoseUsedInReturnOnly() { doTest(); }
|
||||
public void testMethodREfToContainingMethodWithGenericParam() { doTest(); }
|
||||
public void testRawClassTypeOnConstructorWithVarargs() { doTest(); }
|
||||
public void testDistinguishCapturedWildcardsByDifferentParameters() throws Exception { doTest(); }
|
||||
public void testConstructorRefOnClassWithRecursiveTypeParameter() throws Exception { doTest(); }
|
||||
public void testWildcardInCheckedCompatibilityConstraints() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user