void (@NotNull PsiNewExpression expression) { if (ConstructionUtils.isEmptyArrayInitializer(expression)) { PsiType type = expression.getType(); if (type instanceof PsiArrayType) { PsiType arrayType = ((PsiArrayType)type).getComponentType(); PsiClass typeClass = PsiTypesUtil.getPsiClass(arrayType); if (typeClass != null) { for (PsiField field : typeClass.getFields()) { PsiModifierList modifiers = field.getModifierList(); if (modifiers != null && !typeClass.isEquivalentTo(PsiTreeUtil.findFirstParent(expression, e -> e instanceof PsiClass)) && modifiers.hasModifierProperty(PsiModifier.PUBLIC) && field.getType().equals(type) && CollectionUtils.isConstantEmptyArray(field)) { registerError(expression, typeClass, field); return; } } } } } super.visitNewExpression(expression); }