boolean (@Nullable PsiElement qualifier) { if (qualifier == null) { return true; } return PsiTreeUtil.processElements(qualifier, expression -> { if (expression instanceof PsiCallExpression || expression instanceof PsiArrayAccessExpression || expression instanceof PsiTypeCastExpression) { return false; } if (expression instanceof PsiReferenceExpression && !(expression.getParent() instanceof PsiCallExpression)) { PsiElement element = ((PsiReferenceExpression)expression).resolve(); if (element instanceof PsiField && !((PsiField)element).hasModifierProperty(PsiModifier.FINAL)) { return false; } return NullabilityUtil.getExpressionNullability((PsiExpression)expression, true) != Nullability.NULLABLE; } return true; }); }