AllowedValues (PsiMethodCallExpression call) { Integer argument = ObjectUtils.tryCast(ExpressionUtils.computeConstantExpression(call.getArgumentList().getExpressions()[0]), Integer.class); PsiMethod method = call.resolveMethod(); if (method == null || argument == null) return null; return CachedValuesManager.getCachedValue(method, () -> { PsiElementFactory factory = JavaPsiFacade.getElementFactory(method.getProject()); Function<String[], AllowedValues> converter = strings -> { String expression = StreamEx.of(strings) .map((CommonClassNames.JAVA_UTIL_CALENDAR + ".")::concat).joining(",", "{", "}"); PsiArrayInitializerExpression initializer = (PsiArrayInitializerExpression)factory.createExpressionFromText(expression, method); return new AllowedValues(initializer.getInitializers(), false); }; Map<Integer, AllowedValues> map = new HashMap<>(); final String[] days = {"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"}; map.put(Calendar.DAY_OF_WEEK, converter.apply(days)); final String[] months = {"JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"}; map.put(Calendar.MONTH, converter.apply(months)); final String[] amPm = {"AM", "PM"}; map.put(Calendar.AM_PM, converter.apply(amPm)); return CachedValueProvider.Result.create(map, method); }).get(argument); }