void (RegExpGroup group) { super.visitRegExpGroup(group); if (group.getType() != RegExpGroup.Type.NON_CAPTURING) { return; } final PsiElement parent = group.getParent(); final RegExpPattern pattern = group.getPattern(); final RegExpAtom atom = getSingleAtom(pattern); if (atom != null) { if (!(parent instanceof RegExpClosure) || !(atom instanceof RegExpClosure)) { registerProblem(group); } } else if (parent instanceof RegExpBranch) { final RegExpBranch[] branches = pattern.getBranches(); if (branches.length == 1) { if (branches[0].getAtoms().length == 0) { // don't warn on empty group because those already get an empty group warning return; } registerProblem(group); } else { final PsiElement grandParent = parent.getParent(); if (grandParent instanceof RegExpPattern && getSingleAtom((RegExpPattern)grandParent) != null) { registerProblem(group); } } } }