mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
method refs: check if interface functional (IDEA-125511)
This commit is contained in:
+13
-5
@@ -1234,11 +1234,19 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
}
|
||||
if (!myHolder.hasErrorResults()) {
|
||||
final PsiType functionalInterfaceType = expression.getFunctionalInterfaceType();
|
||||
if (functionalInterfaceType != null && LambdaUtil.dependsOnTypeParams(functionalInterfaceType, functionalInterfaceType, expression)) {
|
||||
HighlightInfo result1 =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip("Cyclic inference").create();
|
||||
myHolder.add(result1); //todo[ann] append not inferred type params info
|
||||
} else {
|
||||
if (functionalInterfaceType != null) {
|
||||
final boolean notFunctional = !LambdaUtil.isFunctionalType(functionalInterfaceType);
|
||||
if (notFunctional) {
|
||||
myHolder.add(HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression)
|
||||
.descriptionAndTooltip(functionalInterfaceType.getPresentableText() + " is not a functional interface").create());
|
||||
}
|
||||
else if (LambdaUtil.dependsOnTypeParams(functionalInterfaceType, functionalInterfaceType, expression)) {
|
||||
HighlightInfo result1 =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip("Cyclic inference").create();
|
||||
myHolder.add(result1); //todo[ann] append not inferred type params info
|
||||
}
|
||||
}
|
||||
if (!myHolder.hasErrorResults()) {
|
||||
final PsiElement referenceNameElement = expression.getReferenceNameElement();
|
||||
if (referenceNameElement instanceof PsiKeyword) {
|
||||
if (!PsiMethodReferenceUtil.isValidQualifier(expression)) {
|
||||
|
||||
Reference in New Issue
Block a user