[unused declaration] take into account non-local returns (IDEA-295261)

GitOrigin-RevId: 772f91c8fe5614b0075394979f383e2810a6d3a8
This commit is contained in:
Anna Kozlova
2022-06-02 13:10:07 +02:00
committed by intellij-monorepo-bot
parent 6133b930b9
commit b582eff8c3
2 changed files with 14 additions and 1 deletions

View File

@@ -312,7 +312,11 @@ public class RefJavaUtilImpl extends RefJavaUtil {
refMethod = (RefMethodImpl)refFrom;
}
else if (refFrom instanceof RefFunctionalExpression) {
if (decl instanceof ULambdaExpression) {
UElement target = node.getJumpTarget();
if (target instanceof UMethod) {
refMethod = ObjectUtils.tryCast(refManager.getReference(target.getSourcePsi()), RefMethodImpl.class);
}
else if (decl instanceof ULambdaExpression) {
PsiMethod lambdaMethod = LambdaUtil.getFunctionalInterfaceMethod(((ULambdaExpression)decl).getFunctionalInterfaceType());
refMethod = ObjectUtils.tryCast(refManager.getReference(lambdaMethod), RefMethodImpl.class);
}