public List<Violation> applyTo(SourceCode sourceCode) throws Throwable {
        try {
            validateAstCompilerPhase(sourceCode);
            validate();
            List<Violation> violations = new ArrayList<Violation>();
            if (shouldApplyThisRuleTo(sourceCode)) {
                applyTo(sourceCode, violations);
            }
            overrideViolationMessageIfNecessary(violations);
            return violations;
        } catch(Throwable t) {
            LOG.error("Error from [" + getClass().getName() + "] processing source file [" + sourceCode.getPath() + "]", t);
            throw t;
        }
    }
public List < Violation > applyTo ( SourceCode sourceCode ) throws Throwable { try { validateAstCompilerPhase ( sourceCode ) ; validate ( ) ; List < Violation > violations = new ArrayList < Violation > ( ) ; if ( shouldApplyThisRuleTo ( sourceCode ) ) { applyTo ( sourceCode , violations ) ; } overrideViolationMessageIfNecessary ( violations ) ; return violations ; } catch ( Throwable t ) { LOG . error ( "Error from [" + getClass ( ) . getName ( ) + "] processing source file [" + sourceCode . getPath ( ) + "]" , t ) ; throw t ; } }
Apply this rule to the specified source and return a list of violations (or an empty List).
This implementation delegates to the abstract applyCode(SourceCode,List), provided by
concrete subclasses. This template method simplifies subclass implementations and also
enables common handling of enablement logic.
@param sourceCode - the source to apply this rule to
@return the List of violations; may be empty