public static @Nullable Nullability extractNullityFromWhenValue(@NotNull PsiAnnotation nonNull) {
    PsiAnnotationMemberValue when = nonNull.findAttributeValue("when");
    if (when instanceof PsiReferenceExpression) {
      String refName = ((PsiReferenceExpression)when).getReferenceName();
      if ("ALWAYS".equals(refName)) {
        return Nullability.NOT_NULL;
      }
      if ("MAYBE".equals(refName) || "NEVER".equals(refName)) {
        return Nullability.NULLABLE;
      }
      if ("UNKNOWN".equals(refName)) {
        return Nullability.UNKNOWN;
      }
    }

    // 'when' is unknown and annotation is known -> default value (for javax.annotation.Nonnull is ALWAYS)
    if (when == null) {
      return Nullability.NOT_NULL;
    }
    return null;
  }
public static @Nullable Nullability extractNullityFromWhenValue(@NotNull PsiAnnotation nonNull)