private void checkCompounds(List<SyntaxElement> children) { for (SyntaxElement syntaxElement : children) { if (syntaxElement instanceof CompoundDefinition) { CompoundDefinition compound = (CompoundDefinition) syntaxElement; Cardinality cardinality = compound.getCardinality(); boolean hasUnlimitedUpperBound = cardinality == Cardinality.PLUS || cardinality == Cardinality.STAR; if (hasUnlimitedUpperBound) { // check whether the compound allows the empty sentence if (csUtil.canBeEmpty(compound.getDefinition(), true)) { addProblem( CsAnalysisProblemType.EMPTY_COMPOUND, EMPTY_COMPOUND_MESSAGE, compound, new RemoveElementQuickFix("Remove compound", compound)); } } } checkCompounds(syntaxElement.getChildren()); } }