DfType (@Nullable Object obj) { if (obj instanceof PsiEnumConstant constant) { PsiClass psiClass = constant.getContainingClass(); if (psiClass != null) { int ordinal = 0; for (PsiField field : psiClass.getFields()) { if (field == constant) return DfTypes.intValue(ordinal); if (field instanceof PsiEnumConstant) { ordinal++; } } } } return super.fromConstant(obj); }