boolean (PsiExpression fn) { if (fn instanceof PsiLambdaExpression) { PsiElement body = ((PsiLambdaExpression)fn).getBody(); if (body != null) { return SideEffectChecker.mayHaveSideEffects(body, x -> false); } } if (fn instanceof PsiMethodReferenceExpression) { PsiElement target = ((PsiMethodReferenceExpression)fn).resolve(); return !(target instanceof PsiMethod) || !JavaMethodContractUtil.isPure((PsiMethod)target); } return true; }