// TODO move this to some class?
public static Set<SootClass> findPredecessorWebApp(
StateMachine stateMachine, JwigResolver resolver,
SootMethod enclosingMethod) {
Set<SootClass> targetedWebApps = new HashSet<SootClass>();
PredecessorResolver pred = new PredecessorResolver(stateMachine);
HashSet<State> seen = new HashSet<State>();
LinkedList<State> workList = new LinkedList<State>();
workList.add(stateMachine.getState(enclosingMethod));
while (!workList.isEmpty()) {
// move _backwards_ from the current state, gathering any
// webapps on the way - these can be context
State state1 = workList.removeFirst();
SootMethod callingMethod = state1.getMethod();
SootClass declaringClass = callingMethod.getDeclaringClass();
if (resolver.isWebApp(declaringClass)) {
targetedWebApps.add(declaringClass);
} else {
for (Transition predecessor : pred.getPredecessors(state1)) {
if (predecessor instanceof HandlerTransition
|| predecessor instanceof LambdaTransition
|| predecessor instanceof FilterTransition) {
State target = predecessor.getTarget();
if (!seen.contains(target)) {