LongRangeSet (@NotNull PsiAnnotation annotation) { String qualifiedName = annotation.getQualifiedName(); if (qualifiedName == null) { // unresolved annotation? return LongRangeSet.all(); } switch (qualifiedName) { case JETBRAINS_RANGE, CHECKER_RANGE -> { Long from = AnnotationUtil.getLongAttributeValue(annotation, "from"); Long to = AnnotationUtil.getLongAttributeValue(annotation, "to"); if (from != null && to != null && to >= from) { return LongRangeSet.range(from, to); } } case VALIDATION_MIN, JAKARTA_VALIDATION_MIN -> { Long minValue = AnnotationUtil.getLongAttributeValue(annotation, "value"); if (minValue != null && annotation.findDeclaredAttributeValue("groups") == null) { return LongRangeSet.range(minValue, Long.MAX_VALUE); } } case VALIDATION_MAX, JAKARTA_VALIDATION_MAX -> { Long maxValue = AnnotationUtil.getLongAttributeValue(annotation, "value"); if (maxValue != null && annotation.findDeclaredAttributeValue("groups") == null) { return LongRangeSet.range(Long.MIN_VALUE, maxValue); } } case JAKARTA_VALIDATION_NEGATIVE -> { if (annotation.findDeclaredAttributeValue("groups") == null) { return LongRangeSet.range(Long.MIN_VALUE, -1); } } case JAKARTA_VALIDATION_NEGATIVE_OR_ZERO -> { if (annotation.findDeclaredAttributeValue("groups") == null) { return LongRangeSet.range(Long.MIN_VALUE, 0); } } case JAKARTA_VALIDATION_POSITIVE -> { if (annotation.findDeclaredAttributeValue("groups") == null) { return LongRangeSet.range(1, Long.MAX_VALUE); } } case JAKARTA_VALIDATION_POSITIVE_OR_ZERO -> { if (annotation.findDeclaredAttributeValue("groups") == null) { return LongRangeSet.range(0, Long.MAX_VALUE); } } case CHECKER_GTE_NEGATIVE_ONE -> { return LongRangeSet.range(-1, Long.MAX_VALUE); } case JSR305_NONNEGATIVE, CHECKER_NON_NEGATIVE -> { return LongRangeSet.range(0, Long.MAX_VALUE); } case CHECKER_POSITIVE -> { return LongRangeSet.range(1, Long.MAX_VALUE); } case JMH_PARAM -> { PsiAnnotationMemberValue attributeValue = annotation.findDeclaredAttributeValue("value"); Stream<PsiAnnotationMemberValue> stream = attributeValue instanceof PsiArrayInitializerMemberValue array ? Arrays.stream(array.getInitializers()) : Stream.of(attributeValue); return stream.map(value -> { if (value instanceof PsiExpression expr && ExpressionUtils.computeConstantExpression(expr) instanceof String str) { try { return LongRangeSet.point(Long.parseLong(str)); } catch (NumberFormatException ignored) { } } return LongRangeSet.all(); }).reduce(LongRangeSet::join).orElse(LongRangeSet.all()); } } return LongRangeSet.all(); }