mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
redundant return type: method reference/expr lambda with void SAM
global inspection, IDEA-189010
This commit is contained in:
@@ -236,7 +236,8 @@ public class RefJavaUtilImpl extends RefJavaUtil{
|
||||
|
||||
if (refExpression instanceof PsiMethodReferenceExpression) {
|
||||
PsiType returnType = psiMethod.getReturnType();
|
||||
if (!psiMethod.isConstructor() && !PsiType.VOID.equals(returnType)) {
|
||||
if (!psiMethod.isConstructor() &&
|
||||
!PsiType.VOID.equals(LambdaUtil.getFunctionalInterfaceReturnType((PsiFunctionalExpression)refExpression))) {
|
||||
refMethod.setReturnValueUsed(true);
|
||||
addTypeReference(psiFrom, returnType, refFrom.getRefManager());
|
||||
}
|
||||
@@ -257,7 +258,9 @@ public class RefJavaUtilImpl extends RefJavaUtil{
|
||||
if (call != null) {
|
||||
PsiType returnType = psiMethod.getReturnType();
|
||||
if (!psiMethod.isConstructor() && !PsiType.VOID.equals(returnType)) {
|
||||
if (!(call.getParent() instanceof PsiExpressionStatement)) {
|
||||
PsiElement parent = call.getParent();
|
||||
if (!(parent instanceof PsiExpressionStatement) &&
|
||||
!(parent instanceof PsiLambdaExpression && PsiType.VOID.equals(LambdaUtil.getFunctionalInterfaceReturnType((PsiFunctionalExpression)parent)))) {
|
||||
refMethod.setReturnValueUsed(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user