mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
java highlighting: give up check of @PolymorphicSignature methods (IDEA-251449)
GitOrigin-RevId: cf986ee46e52d6cabfc309776559481d42e6c5ce
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3fe319cf9c
commit
636bbda18f
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.core.JavaPsiBundle;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
@@ -162,6 +163,12 @@ public final class PsiMethodReferenceUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
PsiElement element = result.getElement();
|
||||
if (element instanceof PsiMethod &&
|
||||
AnnotationUtil.isAnnotated(((PsiMethod)element), CommonClassNames.JAVA_LANG_INVOKE_MH_POLYMORPHIC, 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TypeConversionUtil.isAssignable(interfaceReturnType, methodReturnType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
class MyTest {
|
||||
private void m(MethodHandle handle) {
|
||||
I stringSupplier = handle::invokeExact;
|
||||
}
|
||||
}
|
||||
interface I {
|
||||
String n() throws Throwable;
|
||||
}
|
||||
@@ -197,6 +197,7 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testVoidConflict() { doTest(); }
|
||||
public void testCreateMethodFromMethodRefApplicability() { doTest(); }
|
||||
public void testErrorMessageOnTopCallWhenFunctionalInterfaceIsNotInferred() { doTest(); }
|
||||
public void testReferencesToPolymorphicMethod() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
|
||||
Reference in New Issue
Block a user