]> git.uio.no Git - ifi-stolz-refaktor.git/blame - software/no.uio.ifi.refaktor/src/no/uio/ifi/refaktor/analyze/analyzers/LegalStatementsChecker.java
Thesis: adding section about the LastStatementCollector
[ifi-stolz-refaktor.git] / software / no.uio.ifi.refaktor / src / no / uio / ifi / refaktor / analyze / analyzers / LegalStatementsChecker.java
CommitLineData
3acc51ac
EK
1package no.uio.ifi.refaktor.analyze.analyzers;
2
398d7e0c
EK
3import java.util.LinkedList;
4import java.util.List;
5
cf94d612 6import no.uio.ifi.refaktor.analyze.collectors.ReturnStatementsChecker;
39f52c8f
EK
7import no.uio.ifi.refaktor.analyze.exceptions.IllegalExpressionFoundException;
8import no.uio.ifi.refaktor.analyze.exceptions.IllegalStatementFoundException;
3acc51ac
EK
9import no.uio.ifi.refaktor.utils.CompilationUnitTextSelection;
10
11public class LegalStatementsChecker {
12
398d7e0c 13 private final List<Checker> checkers;
3acc51ac
EK
14
15 public LegalStatementsChecker(CompilationUnitTextSelection selection) {
398d7e0c 16 checkers = new LinkedList<Checker>();
a922449d
EK
17 checkers.add(new EnclosingInstanceReferenceChecker(selection));
18 // TODO: check out org.eclipse.jdt.internal.corext.refactoring.structure.MoveInstanceMethodProcessor.RecursiveCallFinder
cf94d612 19 checkers.add(new ReturnStatementsChecker(selection));
2356cfdd 20 checkers.add(new AmbiguousReturnValueChecker(selection));
398d7e0c 21 checkers.add(new IllegalStatementsChecker(selection));
3acc51ac
EK
22 }
23
398d7e0c
EK
24 public boolean allStatementsAreLegal() {
25 try {
26 for(Checker checker: checkers)
27 checker.check();
28 } catch (IllegalStatementFoundException e) {
29 return false;
30 } catch (IllegalExpressionFoundException e) {
31 return false;
32 }
33 return true;
3acc51ac
EK
34 }
35
36}