Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package soot.jimple.toolkits.annotation.nullcheck;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 2000 Janus
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import soot.EquivalentValue;
import soot.Unit;
import soot.Value;
import soot.toolkits.graph.ExceptionalUnitGraph;
import soot.toolkits.scalar.FlowSet;
/**
* @deprecated uses deprecated type {@link BranchedRefVarsAnalysis} and seems of no use for Soot so marked for future
* deletion, unless clients object
*/
@Deprecated
public class LocalRefVarsAnalysisWrapper {
// compilation options
private static final boolean computeChecks = true;
private static final boolean discardKTop = true;
Map> unitToVarsBefore;
Map> unitToVarsAfterFall;
Map>> unitToListsOfVarsAfterBranches;
Map> unitToVarsNeedCheck;
Map> unitToVarsDontNeedCheck;
BranchedRefVarsAnalysis analysis;
// utility method to build lists of (ref, value) pairs for a given flow set
// optionally discard (ref, kTop) pairs.
private final List buildList(FlowSet set) {
List lst = new ArrayList();
Iterator it = analysis.refTypeValues.iterator();
while (it.hasNext()) {
EquivalentValue r = it.next();
int refInfo = analysis.refInfo(r, set);
if (!(discardKTop && (refInfo == BranchedRefVarsAnalysis.kTop))) {
lst.add(analysis.getKRefIntPair(r, refInfo));
// remove tops from the list that will be printed for readability
}
}
return lst;
} // buildList
// constructor, where we do all our computations
public LocalRefVarsAnalysisWrapper(ExceptionalUnitGraph graph) {
analysis = new BranchedRefVarsAnalysis(graph);
unitToVarsBefore = new HashMap>(graph.size() * 2 + 1, 0.7f);
unitToVarsAfterFall = new HashMap>(graph.size() * 2 + 1, 0.7f);
unitToListsOfVarsAfterBranches = new HashMap>>(graph.size() * 2 + 1, 0.7f);
unitToVarsNeedCheck = new HashMap>(graph.size() * 2 + 1, 0.7f);
unitToVarsDontNeedCheck = new HashMap>(graph.size() * 2 + 1, 0.7f);
Iterator unitIt = graph.iterator();
while (unitIt.hasNext()) {
FlowSet set;
Unit s = (Unit) unitIt.next();
set = (FlowSet) analysis.getFallFlowAfter(s);
unitToVarsAfterFall.put(s, Collections.unmodifiableList(buildList(set)));
// we get a list of flow sets for branches, iterate over them
{
List branchesFlowsets = analysis.getBranchFlowAfter(s);
List> lst = new ArrayList>(branchesFlowsets.size());
Iterator it = branchesFlowsets.iterator();
while (it.hasNext()) {
set = (FlowSet) it.next();
lst.add(Collections.unmodifiableList(buildList(set)));
}
unitToListsOfVarsAfterBranches.put(s, lst);
} // done with branches
set = (FlowSet) analysis.getFlowBefore(s);
unitToVarsBefore.put(s, Collections.unmodifiableList(buildList(set)));
// NOTE: that set is used in the compute check bellow too
if (computeChecks) {
ArrayList dontNeedCheckVars = new ArrayList();
ArrayList