mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
method refs: do not accept static varargs methods by receiver (IDEA-128534)
This commit is contained in:
@@ -324,7 +324,8 @@ public class PsiMethodReferenceUtil {
|
||||
LOG.assertTrue(signature != null);
|
||||
final PsiType[] parameterTypes = signature.getParameterTypes();
|
||||
final QualifierResolveResult qualifierResolveResult = getQualifierResolveResult(methodRef);
|
||||
return (method.getParameterList().getParametersCount() + 1 == parameterTypes.length || method.isVarArgs() && parameterTypes.length > 0)&&
|
||||
return (method.getParameterList().getParametersCount() + 1 == parameterTypes.length ||
|
||||
method.isVarArgs() && parameterTypes.length > 0 && !method.hasModifierProperty(PsiModifier.STATIC)) &&
|
||||
hasReceiver(parameterTypes, qualifierResolveResult, methodRef);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.util.Set;
|
||||
|
||||
class Test {
|
||||
|
||||
public static void foo(String[] args, final Set<Test> singleton) {
|
||||
singleton.forEach(Test::m);
|
||||
}
|
||||
|
||||
public static void m(Test... others) {}
|
||||
}
|
||||
@@ -297,6 +297,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIDEA128534() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user