mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lambda return value: do not check containing method name against lambda return value
This commit is contained in:
+3
-3
@@ -156,10 +156,10 @@ public class SuspiciousNameCombinationInspectionBase extends BaseJavaBatchLocalI
|
||||
@Override
|
||||
public void visitReturnStatement(final PsiReturnStatement statement) {
|
||||
final PsiExpression returnValue = statement.getReturnValue();
|
||||
PsiMethod containingMethod = PsiTreeUtil.getParentOfType(returnValue, PsiMethod.class);
|
||||
if (returnValue instanceof PsiReferenceExpression && containingMethod != null) {
|
||||
PsiElement containingMethod = PsiTreeUtil.getParentOfType(returnValue, PsiMethod.class, PsiLambdaExpression.class);
|
||||
if (returnValue instanceof PsiReferenceExpression && containingMethod instanceof PsiMethod) {
|
||||
final String refName = ((PsiReferenceExpression)returnValue).getReferenceName();
|
||||
checkCombination(returnValue, containingMethod.getName(), refName, "suspicious.name.return");
|
||||
checkCombination(returnValue, ((PsiMethod)containingMethod).getName(), refName, "suspicious.name.return");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
@@ -3,4 +3,16 @@ public class ReturnValue {
|
||||
int y=0;
|
||||
return y;
|
||||
}
|
||||
|
||||
interface I {
|
||||
int m();
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
I i = () -> {
|
||||
int x = 0;
|
||||
return x;
|
||||
}
|
||||
return i.m();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user