Normalized indentation.

This commit is contained in:
Achim D. Brucker 2016-10-30 16:12:19 +00:00
parent 86b16bd570
commit 30c886d95d
4 changed files with 80 additions and 80 deletions

View File

@ -41,53 +41,53 @@ public class PlugInUtil {
}
public static void populateScope(JavaSourceAnalysisEngine engine, Collection<String> sources, List<String> libs) {
if (null != libs ){
boolean foundLib = false;
for (String lib : libs) {
File libFile = new File(lib);
if (libFile.exists()) {
foundLib = true;
try {
engine.addSystemModule(new JarFileModule(new JarFile(libFile, false)));
} catch (IOException e) {
Assert.fail(e.getMessage());
}
}
}
assert foundLib : "couldn't find library file from " + libs;
}
if (null != libs ) {
boolean foundLib = false;
for (String lib : libs) {
File libFile = new File(lib);
if (libFile.exists()) {
foundLib = true;
try {
engine.addSystemModule(new JarFileModule(new JarFile(libFile, false)));
} catch (IOException e) {
Assert.fail(e.getMessage());
}
}
}
assert foundLib : "couldn't find library file from " + libs;
}
for (String srcFilePath : sources) {
String srcFileName = srcFilePath.substring(srcFilePath.lastIndexOf(File.separator) + 1);
File f = new File(srcFilePath);
Assert.assertTrue("couldn't find " + srcFilePath, f.exists());
if (f.isDirectory()) {
engine.addSourceModule(new SourceDirectoryTreeModule(f));
} else {
engine.addSourceModule(new SourceFileModule(f, srcFileName, null));
}
}
for (String srcFilePath : sources) {
String srcFileName = srcFilePath.substring(srcFilePath.lastIndexOf(File.separator) + 1);
File f = new File(srcFilePath);
Assert.assertTrue("couldn't find " + srcFilePath, f.exists());
if (f.isDirectory()) {
engine.addSourceModule(new SourceDirectoryTreeModule(f));
} else {
engine.addSourceModule(new SourceFileModule(f, srcFileName, null));
}
}
}
public static JavaSourceAnalysisEngine
createECJJavaEngine(Collection<String> sources, List<String> libs, final String [] entryPoints) {
JavaSourceAnalysisEngine engine=null;
if(null == entryPoints){
engine = new ECJJavaSourceAnalysisEngine();
}else{
engine = new ECJJavaSourceAnalysisEngine() {
JavaSourceAnalysisEngine engine=null;
if(null == entryPoints) {
engine = new ECJJavaSourceAnalysisEngine();
} else {
engine = new ECJJavaSourceAnalysisEngine() {
@Override
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha) {
return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha, entryPoints);
}
};
}
}
engine.setExclusionsFile(REGRESSION_EXCLUSIONS);
populateScope(engine, sources, libs);
return engine;
}
}
}

View File

@ -124,7 +124,7 @@ public class SMTChecker {
}
IOperator op = binOpInstruction.getOperator();
if(op == BinaryOpInstruction.Operator.OR) {
return vc.orExpr(exprLhs, exprRhs);
} else if(op == BinaryOpInstruction.Operator.AND) {
@ -254,7 +254,7 @@ public class SMTChecker {
return vc.gtExpr(exprLhs, exprRhs);
} else if(op == CAstBinaryOp.NE) {
return vc.notExpr(vc.eqExpr(exprLhs, exprRhs));
}
}
} else if(defInst instanceof SSAUnaryOpInstruction) { // WALA uses unary operation ONLY for negation
SSAUnaryOpInstruction unaryInst = (SSAUnaryOpInstruction) defInst;

View File

@ -14,32 +14,32 @@ import com.ibm.wala.ssa.SSAInstruction;
public class SSAInstructionKey {
private final SSAInstruction key;
public SSAInstructionKey(SSAInstruction key) {
this.key = key;
}
public int hashCode(){
return key.hashCode();
}
private final SSAInstruction key;
public SSAInstructionKey(SSAInstruction key) {
this.key = key;
}
public String toString(){
if (null == key){
return "null (key)";
}else{
return key.toString();
}
}
public boolean equals(Object obj){
if (null == obj){
return false;
}else{
if (obj instanceof SSAInstructionKey){
return key == ((SSAInstructionKey) obj).key;
}else{
return false;
}
}
}
public int hashCode() {
return key.hashCode();
}
public String toString() {
if (null == key) {
return "null (key)";
} else {
return key.toString();
}
}
public boolean equals(Object obj) {
if (null == obj) {
return false;
} else {
if (obj instanceof SSAInstructionKey) {
return key == ((SSAInstructionKey) obj).key;
} else {
return false;
}
}
}
}

View File

@ -95,8 +95,8 @@ public class SuperGraphUtil {
}
} else {
if(!acceptedMethods.contains(method)) {
log.debug("supergraph cut at '" + bbic.getNumber() + " -> " + nextChild.getNumber() + " ("
+ nextChild.toString() + ")'");
log.debug("supergraph cut at '" + bbic.getNumber() + " -> " + nextChild.getNumber() + " ("
+ nextChild.toString() + ")'");
continue;
}
}
@ -172,15 +172,15 @@ public class SuperGraphUtil {
i++;
}
if(mainEntryId == 0 && mainExitId == 0) {
log.error(" "+entryClass + "." + entryMethod +
": empty entry method, ensure invocation in main method " +
"(mainEntryId = " +mainEntryId + " / mainExitId = " + mainExitId + ")");
log.error(" "+entryClass + "." + entryMethod +
": empty entry method, ensure invocation in main method " +
"(mainEntryId = " +mainEntryId + " / mainExitId = " + mainExitId + ")");
return -1;
}
HashSet<Integer> relevantIDs = new HashSet<Integer>();
BasicBlockInContext<IExplodedBasicBlock> bbic = sgNodes.get(mainEntryId);
acceptedMethods.add(bbic.getMethod().getReference());
log.error(" "+entryClass + "." + entryMethod +
log.error(" "+entryClass + "." + entryMethod +
"start recursive graph building");
relevantPathSearch(relevantIDs, sg, sgNodes, sgNodesReversed, acceptedMethods, mainEntryId, mainExitId);
@ -196,7 +196,7 @@ public class SuperGraphUtil {
}
// build separate adjacency list
log.debug(" "+entryClass + "." + entryMethod +
log.debug(" "+entryClass + "." + entryMethod +
"build seperate adjacency list");
HashMap<Integer, ArrayList<Integer>> adjList = new HashMap<Integer, ArrayList<Integer>>();
HashMap<Integer, ArrayList<Integer>> adjListReverse = new HashMap<Integer, ArrayList<Integer>>();
@ -207,19 +207,19 @@ public class SuperGraphUtil {
buildAdjacencyLists(sg, sgNodes, sgNodesReversed, adjList, adjListReverse, emptyNodes, relevantIDs);
// <<< print original adjacency list to log
log.debug("adjacency list before removing empty nodes:");
AnalysisUtil.printAdjList(adjList, log);
log.debug("adjacency list before removing empty nodes:");
AnalysisUtil.printAdjList(adjList, log);
//
if(removeEmptyNodes) {
removeEmptyNodes(emptyNodes, adjList, adjListReverse, sgNodes, sgNodesReversed);
// <<< print adjacency list to log
log.debug("adjacency after removing empty nodes:");
AnalysisUtil.printAdjList(adjList, log);
log.debug("adjacency after removing empty nodes:");
AnalysisUtil.printAdjList(adjList, log);
//
}
log.debug(" "+entryClass + "." + entryMethod +
log.debug(" "+entryClass + "." + entryMethod +
"add conditions to graph nodes");
ArrayList<Integer> visited = new ArrayList<Integer>();
ArrayList<Integer> currentConditions = new ArrayList<Integer>();
@ -483,10 +483,10 @@ public class SuperGraphUtil {
HashMap<Integer, ArrayList<Integer>> adjList,
HashMap<Integer, HashSet<ArrayList<Integer>>> paths) {
log.debug(" searching for "+currentId+" in adjList.");
log.debug(" searching for "+currentId+" in adjList.");
ArrayList<Integer> children = adjList.get(currentId);
if (null == children) {
throw new RuntimeException ("No entry found in adjList for "+currentId);
throw new RuntimeException ("No entry found in adjList for "+currentId);
}
HashSet<ArrayList<Integer>> currentPaths = new HashSet<ArrayList<Integer>>();
@ -541,8 +541,8 @@ public class SuperGraphUtil {
vc.pop();
vc.push();
if(expr.toString().equalsIgnoreCase("null")) {
log.debug(" isNotMutuallyExclusive: EXPR: "+expr+" is NULL (combinedConditions: "
+ combinedConditions + "/ expressions: " + expressions +")");
log.debug(" isNotMutuallyExclusive: EXPR: "+expr+" is NULL (combinedConditions: "
+ combinedConditions + "/ expressions: " + expressions +")");
return true;
}
SatResult satResult = vc.checkUnsat(expr);