package no.uio.ifi.refaktor.analyze.analyzers; import java.util.LinkedList; import java.util.List; import no.uio.ifi.refaktor.analyze.collectors.ReturnStatementsChecker; import no.uio.ifi.refaktor.analyze.exceptions.CheckerException; import no.uio.ifi.refaktor.utils.CompilationUnitTextSelection; public class LegalStatementsChecker { private final List checkers; public LegalStatementsChecker(CompilationUnitTextSelection selection) { checkers = new LinkedList(); checkers.add(new CallToProtectedOrDefaultMethodChecker(selection)); checkers.add(new EnclosingInstanceReferenceChecker(selection)); // TODO: check out org.eclipse.jdt.internal.corext.refactoring.structure.MoveInstanceMethodProcessor.RecursiveCallFinder checkers.add(new ReturnStatementsChecker(selection)); checkers.add(new AmbiguousReturnValueChecker(selection)); checkers.add(new IllegalStatementsChecker(selection)); } public boolean allStatementsAreLegal() { try { for(Checker checker: checkers) checker.check(); } catch (CheckerException e) { return false; } return true; } }