01: package spoon.vsuite.common;
02:
03: import spoon.processing.AbstractProcessor;
04: import spoon.processing.Property;
05: import spoon.processing.Severity;
06: import spoon.reflect.code.CtCatch;
07:
08: /**
09: * Report warnings when empty catch blocks are found.
10: */
11: public class EmptyCatchProcessor extends AbstractProcessor<CtCatch> {
12:
13: @Property
14: Severity level = Severity.WARNING;
15:
16: public void process(CtCatch element) {
17: if (element.getBody().getStatements().size() == 0) {
18: getFactory().getEnvironment().report(this , level, element,
19: "Empty catch clause");
20: }
21: }
22:
23: }
|