public static boolean checkQualifier(@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 ref && !(expression.getParent() instanceof PsiCallExpression)) {
        PsiElement element = ref.resolve();
        if (element instanceof PsiField field && !field.hasModifierProperty(PsiModifier.FINAL)) {
          return false;
        }

        return NullabilityUtil.getExpressionNullability((PsiExpression)expression, true) != Nullability.NULLABLE;
      }
      return true;
    });
  }
public static boolean checkQualifier(@Nullable PsiElement qualifier)