DfType (DfaCallArguments arguments, DfaMemoryState state, DfaValueFactory factory) { if (arguments.myArguments.length != 1) return DfType.TOP; Integer val = state.getDfType(arguments.myArguments[0]).getConstantOfType(Integer.class); if (val == null) return DfType.TOP; LongRangeSet range = switch (val) { case Calendar.DATE -> LongRangeSet.range(1, 31); case Calendar.MONTH -> { PsiType type = TypeConstraint.fromDfType(state.getDfType(arguments.myQualifier)).getPsiType(factory.getProject()); if (TypeUtils.typeEquals("java.util.GregorianCalendar", type)) { yield LongRangeSet.range(0, 11); } else { // Could be lunar calendar yield LongRangeSet.range(0, 12); } } case Calendar.AM_PM -> LongRangeSet.range(0, 1); case Calendar.DAY_OF_YEAR -> LongRangeSet.range(1, 366); case Calendar.HOUR -> LongRangeSet.range(0, 11); case Calendar.HOUR_OF_DAY -> LongRangeSet.range(0, 23); case Calendar.MINUTE, Calendar.SECOND -> LongRangeSet.range(0, 59); case Calendar.MILLISECOND -> LongRangeSet.range(0, 999); default -> null; }; return range == null ? DfType.TOP : intRange(range); }