]>
Commit | Line | Data |
---|---|---|
3acc51ac EK |
1 | package no.uio.ifi.refaktor.analyze.analyzers; |
2 | ||
398d7e0c EK |
3 | import java.util.LinkedList; |
4 | import java.util.List; | |
5 | ||
cf94d612 | 6 | import no.uio.ifi.refaktor.analyze.collectors.ReturnStatementsChecker; |
39f52c8f EK |
7 | import no.uio.ifi.refaktor.analyze.exceptions.IllegalExpressionFoundException; |
8 | import no.uio.ifi.refaktor.analyze.exceptions.IllegalStatementFoundException; | |
3acc51ac EK |
9 | import no.uio.ifi.refaktor.utils.CompilationUnitTextSelection; |
10 | ||
11 | public 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 | } |