void (@NotNull PsiArrayInitializerExpression expression) { super.visitArrayInitializerExpression(expression); final PsiType type = expression.getType(); if (!(type instanceof PsiArrayType)) { return; } final PsiType initExprType = ((PsiArrayType)type).getComponentType(); final PsiClass initClass = PsiUtil.resolveClassInClassTypeOnly(initExprType); if (initClass == null || !initClass.isEnum()) { return; } final List<PsiEnumConstant> enumValues = ContainerUtil.filterIsInstance(Arrays.asList(initClass.getFields()), PsiEnumConstant.class); final PsiExpression[] initializers = expression.getInitializers(); if (enumValues.size() != initializers.length) { return; } for (int i = 0; i < initializers.length; i++) { if (!ExpressionUtils.isReferenceTo(initializers[i], enumValues.get(i))) return; } final PsiElement parent = expression.getParent(); final String enumName = initClass.getQualifiedName(); if (parent instanceof PsiNewExpression) { registerError(parent, enumName); } else { registerError(expression, enumName); } }