Boolean (PsiExpression arg) { // Boolean.TRUE::equals or x -> Boolean.TRUE.equals(x) arg = skipParenthesizedExprDown(arg); PsiReferenceExpression qualifier = null; if (arg instanceof PsiMethodReferenceExpression methodRef) { if (!BOOLEAN_EQUALS.methodReferenceMatches(methodRef)) return null; qualifier = tryCast(methodRef.getQualifierExpression(), PsiReferenceExpression.class); } else if (arg instanceof PsiLambdaExpression lambda) { PsiParameter parameter = ArrayUtil.getFirstElement(lambda.getParameterList().getParameters()); if (parameter == null) return null; PsiMethodCallExpression call = tryCast(LambdaUtil.extractSingleExpressionFromBody(lambda.getBody()), PsiMethodCallExpression.class); if (!BOOLEAN_EQUALS.test(call)) return null; if (!ExpressionUtils.isReferenceTo(call.getArgumentList().getExpressions()[0], parameter)) return null; qualifier = tryCast(call.getMethodExpression().getQualifierExpression(), PsiReferenceExpression.class); } if (qualifier == null) return null; PsiField field = tryCast(qualifier.resolve(), PsiField.class); if (field == null) return null; PsiClass containingClass = field.getContainingClass(); if (containingClass != null && JAVA_LANG_BOOLEAN.equals(containingClass.getQualifiedName())) { String name = field.getName(); if ("TRUE".equals(name)) return Boolean.TRUE; if ("FALSE".equals(name)) return Boolean.FALSE; } return null; }