Commits

Anonymous committed 23a48ea

Removing AbstractTypeRule

Comments (0)

Files changed (1)

analysis/src/j1/tutorial/javac/analysis/api/AbstractTypeRule.java

-package j1.tutorial.javac.analysis.api;
-
-import com.sun.source.tree.ClassTree;
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.util.TreePathScanner;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.TypeElement;
-
-public abstract class AbstractTypeRule implements Rule {
-
-    @Override
-    public void analyseFile(final AnalysisContext ctx, CompilationUnitTree file) {
-        new TreePathScanner<Void, Void>() {
-            @Override public Void visitClass(ClassTree node, Void p) {
-                Element el = ctx.getTrees().getElement(getCurrentPath());
-                
-                if (el != null && (el.getKind().isClass() || el.getKind().isInterface())) {
-                    analyseType(ctx, (TypeElement) el);
-                }
-                return super.visitClass(node, p);
-            }
-
-        }.scan(file, null);
-    }
-    
-    protected abstract void analyseType(AnalysisContext ctx, TypeElement typeElement);
-}