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.declaration.CtClass;
07: import spoon.reflect.declaration.CtExecutable;
08: import spoon.reflect.declaration.ModifierKind;
09:
10: public class EmptyExecutableProcessor extends
11: AbstractProcessor<CtExecutable<?>> {
12:
13: @Property
14: Severity level = Severity.WARNING;
15:
16: public void process(CtExecutable<?> element) {
17: if (element.getParent(CtClass.class) != null
18: && !element.getModifiers().contains(
19: ModifierKind.ABSTRACT)
20: && element.getBody().getStatements().size() == 0) {
21: getFactory().getEnvironment().report(this , level, element,
22: "Empty block");
23: }
24: }
25:
26: }
|