boolean (PsiMethod method) { Predicate<PsiMethod> predicate = m -> { PsiCodeBlock body = m.getBody(); if (body == null) return false; PsiStatement[] statements = body.getStatements(); if (statements.length != 1 || !(statements[0] instanceof PsiReturnStatement)) return false; PsiExpression value = ((PsiReturnStatement)statements[0]).getReturnValue(); return BoolUtils.isTrue(value); }; return CachedValuesManager.getCachedValue(method, () -> CachedValueProvider.Result.create(predicate.test(method), method)); }