List<PsiEnumConstant> (Set<PsiEnumConstant> constants, PsiMethod method) { String methodName = method.getName(); ArrayList<PsiEnumConstant> result = new ArrayList<>(); for (PsiEnumConstant enumConstant : constants) { PsiClass containingClass = enumConstant.getContainingClass(); if (containingClass == null || !containingClass.isEnum()) { return null; } String classQualifiedName = containingClass.getQualifiedName(); if (!(ChronoUtil.CHRONO_FIELD.equals(classQualifiedName) && (methodName.equals("get") || methodName.equals("getLong") || methodName.equals("with"))) && !(ChronoUtil.CHRONO_UNIT.equals(classQualifiedName)) && (methodName.equals("plus") || methodName.equals("minus"))) { return null; } String enumConstantName = enumConstant.getName(); switch (methodName) { case "get", "getLong" -> { if (!ChronoUtil.isAnyGetSupported(method, ChronoUtil.getChronoField(enumConstantName))) { result.add(enumConstant); } } case "with" -> { if (!ChronoUtil.isWithSupported(method, ChronoUtil.getChronoField(enumConstantName))) { result.add(enumConstant); } } case "plus", "minus" -> { if (!ChronoUtil.isPlusMinusSupported(method, ChronoUtil.getChronoUnit(enumConstantName))) { result.add(enumConstant); } } } } return result; }