diff --git a/Jenkinsfile b/Jenkinsfile
index 271ab982..7bc5ec66 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -34,7 +34,7 @@ pipeline {
maven: 'Maven 3.6.3',
mavenSettingsConfig: '9ff5ed8e-79e5-4010-b7e2-f137f16176dd') {
- sh 'mvn -P ci com.coveo:fmt-maven-plugin:check -DskipFormatPlugin=false'
+ sh 'mvn -P ci com.coveo:fmt-maven-plugin:check -DskipFormat=false'
}
}
}
diff --git a/PDS/pom.xml b/PDS/pom.xml
new file mode 100644
index 00000000..87432dce
--- /dev/null
+++ b/PDS/pom.xml
@@ -0,0 +1,20 @@
+
+
+
+ de.fraunhofer.iem
+ SPDS
+ 3.2.3
+ ../pom.xml
+
+ 4.0.0
+ PDS
+
+
+ 11
+ 11
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/WPDS/src/main/java/wpds/interfaces/Empty.java b/PDS/src/main/java/de/fraunhofer/iem/Empty.java
similarity index 95%
rename from WPDS/src/main/java/wpds/interfaces/Empty.java
rename to PDS/src/main/java/de/fraunhofer/iem/Empty.java
index 48b0f43d..0ad2cfcd 100644
--- a/WPDS/src/main/java/wpds/interfaces/Empty.java
+++ b/PDS/src/main/java/de/fraunhofer/iem/Empty.java
@@ -9,6 +9,6 @@
*
Contributors: Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
-package wpds.interfaces;
+package de.fraunhofer.iem;
public interface Empty {}
diff --git a/WPDS/src/main/java/wpds/interfaces/Location.java b/PDS/src/main/java/de/fraunhofer/iem/Location.java
similarity index 95%
rename from WPDS/src/main/java/wpds/interfaces/Location.java
rename to PDS/src/main/java/de/fraunhofer/iem/Location.java
index 41234dde..f514033f 100644
--- a/WPDS/src/main/java/wpds/interfaces/Location.java
+++ b/PDS/src/main/java/de/fraunhofer/iem/Location.java
@@ -9,7 +9,7 @@
*
Contributors: Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
-package wpds.interfaces;
+package de.fraunhofer.iem;
public interface Location {
boolean accepts(Location other);
diff --git a/WPDS/src/main/java/wpds/wildcard/ExclusionWildcard.java b/PDS/src/main/java/de/fraunhofer/iem/wildcard/ExclusionWildcard.java
similarity index 90%
rename from WPDS/src/main/java/wpds/wildcard/ExclusionWildcard.java
rename to PDS/src/main/java/de/fraunhofer/iem/wildcard/ExclusionWildcard.java
index af0d463c..630fffe3 100644
--- a/WPDS/src/main/java/wpds/wildcard/ExclusionWildcard.java
+++ b/PDS/src/main/java/de/fraunhofer/iem/wildcard/ExclusionWildcard.java
@@ -9,8 +9,8 @@
*
Contributors: Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
-package wpds.wildcard;
+package de.fraunhofer.iem.wildcard;
public interface ExclusionWildcard extends Wildcard {
- public Location excludes();
+ Location excludes();
}
diff --git a/WPDS/src/main/java/wpds/wildcard/Wildcard.java b/PDS/src/main/java/de/fraunhofer/iem/wildcard/Wildcard.java
similarity index 88%
rename from WPDS/src/main/java/wpds/wildcard/Wildcard.java
rename to PDS/src/main/java/de/fraunhofer/iem/wildcard/Wildcard.java
index 3eb409b6..7ad80b72 100644
--- a/WPDS/src/main/java/wpds/wildcard/Wildcard.java
+++ b/PDS/src/main/java/de/fraunhofer/iem/wildcard/Wildcard.java
@@ -9,8 +9,8 @@
* Contributors: Johannes Spaeth - initial API and implementation
* *****************************************************************************
*/
-package wpds.wildcard;
+package de.fraunhofer.iem.wildcard;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
public interface Wildcard extends Location {}
diff --git a/PDS/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/PDS/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 00000000..3246b19d
--- /dev/null
+++ b/PDS/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,4 @@
+de/fraunhofer/iem/wildcard/ExclusionWildcard.class
+de/fraunhofer/iem/Empty.class
+de/fraunhofer/iem/Location.class
+de/fraunhofer/iem/wildcard/Wildcard.class
diff --git a/PDS/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/PDS/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 00000000..254bc518
--- /dev/null
+++ b/PDS/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,4 @@
+/home/smarkus/workspace/Java/SparseBoomerang/PDS/src/main/java/de/fraunhofer/iem/Empty.java
+/home/smarkus/workspace/Java/SparseBoomerang/PDS/src/main/java/de/fraunhofer/iem/Location.java
+/home/smarkus/workspace/Java/SparseBoomerang/PDS/src/main/java/de/fraunhofer/iem/wildcard/ExclusionWildcard.java
+/home/smarkus/workspace/Java/SparseBoomerang/PDS/src/main/java/de/fraunhofer/iem/wildcard/Wildcard.java
diff --git a/PDS/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/PDS/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 00000000..e69de29b
diff --git a/PDS/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/PDS/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 00000000..e69de29b
diff --git a/SparseBoomerangCorrectness/pom.xml b/SparseBoomerangCorrectness/pom.xml
index f08f403f..2c72f953 100644
--- a/SparseBoomerangCorrectness/pom.xml
+++ b/SparseBoomerangCorrectness/pom.xml
@@ -10,6 +10,20 @@
4.0.0
SparseBoomerangCorrectness
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 3.1.2
+
+ true
+
+
+
+
+
junit
diff --git a/SparseBoomerangCorrectness/src/main/java/aliasing/SparseAliasManager.java b/SparseBoomerangCorrectness/src/main/java/aliasing/SparseAliasManager.java
index 6b4e0114..a3940d54 100644
--- a/SparseBoomerangCorrectness/src/main/java/aliasing/SparseAliasManager.java
+++ b/SparseBoomerangCorrectness/src/main/java/aliasing/SparseAliasManager.java
@@ -6,7 +6,7 @@
import boomerang.results.BackwardBoomerangResults;
import boomerang.scene.*;
import boomerang.scene.jimple.*;
-import boomerang.scene.sparse.SparseCFGCache;
+import boomerang.sparse.SparsificationStrategy;
import boomerang.util.AccessPath;
import com.google.common.base.Stopwatch;
import com.google.common.cache.CacheBuilder;
@@ -35,24 +35,24 @@ public class SparseAliasManager {
private DataFlowScope dataFlowScope;
private boolean disableAliasing = false;
- private SparseCFGCache.SparsificationStrategy sparsificationStrategy;
+ private SparsificationStrategy sparsificationStrategy;
private boolean ignoreAfterQuery;
static class BoomerangOptions extends DefaultBoomerangOptions {
- private SparseCFGCache.SparsificationStrategy sparsificationStrategy;
+ private SparsificationStrategy sparsificationStrategy;
private boolean ignoreAfterQuery;
public BoomerangOptions(
- SparseCFGCache.SparsificationStrategy sparsificationStrategy, boolean ignoreAfterQuery) {
+ SparsificationStrategy sparsificationStrategy, boolean ignoreAfterQuery) {
this.sparsificationStrategy = sparsificationStrategy;
this.ignoreAfterQuery = ignoreAfterQuery;
}
@Override
- public SparseCFGCache.SparsificationStrategy getSparsificationStrategy() {
+ public SparsificationStrategy getSparsificationStrategy() {
if (this.sparsificationStrategy == null) {
- return SparseCFGCache.SparsificationStrategy.NONE;
+ return SparsificationStrategy.NONE;
}
return this.sparsificationStrategy;
}
@@ -96,7 +96,7 @@ public boolean trackAnySubclassOfThrowable() {
private static Duration totalAliasingDuration;
private SparseAliasManager(
- SparseCFGCache.SparsificationStrategy sparsificationStrategy, boolean ignoreAfterQuery) {
+ SparsificationStrategy sparsificationStrategy, boolean ignoreAfterQuery) {
this.sparsificationStrategy = sparsificationStrategy;
this.ignoreAfterQuery = ignoreAfterQuery;
totalAliasingDuration = Duration.ZERO;
@@ -110,7 +110,7 @@ public static Duration getTotalDuration() {
}
public static synchronized SparseAliasManager getInstance(
- SparseCFGCache.SparsificationStrategy sparsificationStrategy, boolean ignoreAfterQuery) {
+ SparsificationStrategy sparsificationStrategy, boolean ignoreAfterQuery) {
if (INSTANCE == null
|| INSTANCE.sparsificationStrategy != sparsificationStrategy
|| INSTANCE.ignoreAfterQuery != ignoreAfterQuery) {
diff --git a/SparseBoomerangCorrectness/src/test/java/test/aliasing/AliasingTestSetUp.java b/SparseBoomerangCorrectness/src/test/java/test/aliasing/AliasingTestSetUp.java
index e8b5047e..3697f2a6 100644
--- a/SparseBoomerangCorrectness/src/test/java/test/aliasing/AliasingTestSetUp.java
+++ b/SparseBoomerangCorrectness/src/test/java/test/aliasing/AliasingTestSetUp.java
@@ -4,7 +4,6 @@
import aliasing.SparseAliasManager;
import boomerang.scene.jimple.BoomerangPretransformer;
-import boomerang.scene.sparse.SparseCFGCache;
import boomerang.util.AccessPath;
import com.google.common.base.Predicate;
import java.io.File;
@@ -32,7 +31,7 @@ public Set executeStaticAnalysis(
String targetClassName,
String targetMethod,
String queryLHS,
- SparseCFGCache.SparsificationStrategy sparsificationStrategy,
+ SparsificationStrategy sparsificationStrategy,
boolean ignoreAfterQuery) {
setupSoot(targetClassName);
registerSootTransformers(queryLHS, sparsificationStrategy, targetMethod, ignoreAfterQuery);
@@ -78,7 +77,7 @@ protected void setupSoot(String targetTestClassName) {
public Set getAliases(
SootMethod method,
String queryLHS,
- SparseCFGCache.SparsificationStrategy sparsificationStrategy,
+ SparsificationStrategy sparsificationStrategy,
boolean ignoreAfterQuery) {
String[] split = queryLHS.split("\\.");
Optional unitOp;
@@ -117,7 +116,7 @@ public Set getAliases(
protected Transformer createAnalysisTransformer(
String queryLHS,
- SparseCFGCache.SparsificationStrategy sparsificationStrategy,
+ SparsificationStrategy sparsificationStrategy,
String targetMethod,
boolean ignoreAfterQuery) {
return new SceneTransformer() {
@@ -153,7 +152,7 @@ protected SootMethod getEntryPointMethod(String targetMethod) {
protected void registerSootTransformers(
String queryLHS,
- SparseCFGCache.SparsificationStrategy sparsificationStrategy,
+ SparsificationStrategy sparsificationStrategy,
String targetMethod,
boolean ignoreAfterQuery) {
Transform transform =
@@ -175,66 +174,43 @@ protected void executeSootTransformers() {
protected void runAnalyses(String queryLHS, String targetClass, String targetMethod) {
Set nonSparseAliases =
- getAliases(
- targetClass, queryLHS, targetMethod, SparseCFGCache.SparsificationStrategy.NONE, true);
+ getAliases(targetClass, queryLHS, targetMethod, SparsificationStrategy.NONE, true);
Set typeBasedSparseAliases =
- getAliases(
- targetClass,
- queryLHS,
- targetMethod,
- SparseCFGCache.SparsificationStrategy.TYPE_BASED,
- true);
+ getAliases(targetClass, queryLHS, targetMethod, SparsificationStrategy.TYPE_BASED, true);
Set aliasAwareSparseAliases =
- getAliases(
- targetClass,
- queryLHS,
- targetMethod,
- SparseCFGCache.SparsificationStrategy.ALIAS_AWARE,
- true);
- checkResults(
- SparseCFGCache.SparsificationStrategy.TYPE_BASED, typeBasedSparseAliases, nonSparseAliases);
- checkResults(
- SparseCFGCache.SparsificationStrategy.ALIAS_AWARE,
- aliasAwareSparseAliases,
- nonSparseAliases);
+ getAliases(targetClass, queryLHS, targetMethod, SparsificationStrategy.ALIAS_AWARE, true);
+ checkResults(SparsificationStrategy.TYPE_BASED, typeBasedSparseAliases, nonSparseAliases);
+ checkResults(SparsificationStrategy.ALIAS_AWARE, aliasAwareSparseAliases, nonSparseAliases);
}
protected void runAnalyses(
String queryLHS, String targetClass, String targetMethod, boolean ignoreAfterQuery) {
Set nonSparseAliases =
getAliases(
- targetClass,
- queryLHS,
- targetMethod,
- SparseCFGCache.SparsificationStrategy.NONE,
- ignoreAfterQuery);
+ targetClass, queryLHS, targetMethod, SparsificationStrategy.NONE, ignoreAfterQuery);
Set typeBasedSparseAliases =
getAliases(
targetClass,
queryLHS,
targetMethod,
- SparseCFGCache.SparsificationStrategy.TYPE_BASED,
+ SparsificationStrategy.TYPE_BASED,
ignoreAfterQuery);
Set aliasAwareSparseAliases =
getAliases(
targetClass,
queryLHS,
targetMethod,
- SparseCFGCache.SparsificationStrategy.ALIAS_AWARE,
+ SparsificationStrategy.ALIAS_AWARE,
ignoreAfterQuery);
- checkResults(
- SparseCFGCache.SparsificationStrategy.TYPE_BASED, typeBasedSparseAliases, nonSparseAliases);
- checkResults(
- SparseCFGCache.SparsificationStrategy.ALIAS_AWARE,
- aliasAwareSparseAliases,
- nonSparseAliases);
+ checkResults(SparsificationStrategy.TYPE_BASED, typeBasedSparseAliases, nonSparseAliases);
+ checkResults(SparsificationStrategy.ALIAS_AWARE, aliasAwareSparseAliases, nonSparseAliases);
}
protected Set getAliases(
String targetClass,
String queryLHS,
String targetMethod,
- SparseCFGCache.SparsificationStrategy sparsificationStrategy,
+ SparsificationStrategy sparsificationStrategy,
boolean ignoreAfterQuery) {
Set aliases =
executeStaticAnalysis(
@@ -243,7 +219,7 @@ protected Set getAliases(
}
protected void checkResults(
- SparseCFGCache.SparsificationStrategy strategy,
+ SparsificationStrategy strategy,
Set sparseAliases,
Set nonSparseAliases) {
List nonSparse =
diff --git a/SynchronizedPDS/.settings/org.eclipse.m2e.core.prefs b/SynchronizedPDS/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index f897a7f1..00000000
--- a/SynchronizedPDS/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/SynchronizedPDS/pom.xml b/SynchronizedPDS/pom.xml
index 59f0ee4f..6b889d3b 100644
--- a/SynchronizedPDS/pom.xml
+++ b/SynchronizedPDS/pom.xml
@@ -12,7 +12,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.5.2
+ ${maven-surefire-plugin.version}
-Xmx8G -Xss128m
@@ -36,5 +36,9 @@
junit
junit
+
+ de.fraunhofer.iem
+ PDS
+
\ No newline at end of file
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/CastNormalRule.java b/SynchronizedPDS/src/main/java/sync/pds/solver/CastNormalRule.java
index 2a8a7d0b..dd0f4436 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/CastNormalRule.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/CastNormalRule.java
@@ -11,10 +11,10 @@
*/
package sync.pds.solver;
+import de.fraunhofer.iem.Location;
import wpds.impl.NormalRule;
import wpds.impl.Transition;
import wpds.impl.Weight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public class CastNormalRule
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/OneWeightFunctions.java b/SynchronizedPDS/src/main/java/sync/pds/solver/OneWeightFunctions.java
index 09471078..6dfc28fa 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/OneWeightFunctions.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/OneWeightFunctions.java
@@ -16,7 +16,7 @@
public class OneWeightFunctions
implements WeightFunctions {
- private W one;
+ private final W one;
public OneWeightFunctions(W one) {
this.one = one;
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSSolver.java b/SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSSolver.java
index 827728fa..cca4c38a 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSSolver.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSSolver.java
@@ -17,6 +17,7 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
+import de.fraunhofer.iem.Location;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashSet;
@@ -42,7 +43,6 @@
import wpds.impl.Weight;
import wpds.impl.WeightedPAutomaton;
import wpds.impl.WeightedPushdownSystem;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
import wpds.interfaces.WPAStateListener;
import wpds.interfaces.WPAUpdateListener;
@@ -61,13 +61,13 @@ public enum PDSSystem {
protected final WeightedPushdownSystem, W> callingPDS =
new WeightedPushdownSystem, W>() {
public String toString() {
- return "Call " + SyncPDSSolver.this.toString();
+ return "Call " + SyncPDSSolver.this;
}
};
protected final WeightedPushdownSystem>, W> fieldPDS =
new WeightedPushdownSystem>, W>() {
public String toString() {
- return "Field " + SyncPDSSolver.this.toString();
+ return "Field " + SyncPDSSolver.this;
}
};
private final Set> reachedStates = Sets.newHashSet();
@@ -206,7 +206,7 @@ public void nestedAutomaton(
private class FieldAddEpsilonToInitialStateListener
extends WPAStateListener>, W> {
- private WeightedPAutomaton>, W> parent;
+ private final WeightedPAutomaton>, W> parent;
public FieldAddEpsilonToInitialStateListener(
INode> state,
@@ -249,9 +249,8 @@ public boolean equals(Object obj) {
FieldAddEpsilonToInitialStateListener other = (FieldAddEpsilonToInitialStateListener) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (parent == null) {
- if (other.parent != null) return false;
- } else if (!parent.equals(other.parent)) return false;
- return true;
+ return other.parent == null;
+ } else return parent.equals(other.parent);
}
private SyncPDSSolver getOuterType() {
@@ -261,7 +260,7 @@ private SyncPDSSolver getOuterType() {
private class FieldOnOutTransitionAddToStateListener
extends WPAStateListener>, W> {
- private Transition>> nestedT;
+ private final Transition>> nestedT;
public FieldOnOutTransitionAddToStateListener(
INode> state, Transition>> nestedT) {
@@ -300,9 +299,8 @@ public boolean equals(Object obj) {
FieldOnOutTransitionAddToStateListener other = (FieldOnOutTransitionAddToStateListener) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (nestedT == null) {
- if (other.nestedT != null) return false;
- } else if (!nestedT.equals(other.nestedT)) return false;
- return true;
+ return other.nestedT == null;
+ } else return nestedT.equals(other.nestedT);
}
private SyncPDSSolver getOuterType() {
@@ -323,7 +321,7 @@ public void nestedAutomaton(
private class AddEpsilonToInitialStateListener extends WPAStateListener, W> {
- private WeightedPAutomaton, W> parent;
+ private final WeightedPAutomaton, W> parent;
public AddEpsilonToInitialStateListener(
INode state, WeightedPAutomaton, W> parent) {
@@ -364,9 +362,8 @@ public boolean equals(Object obj) {
AddEpsilonToInitialStateListener other = (AddEpsilonToInitialStateListener) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (parent == null) {
- if (other.parent != null) return false;
- } else if (!parent.equals(other.parent)) return false;
- return true;
+ return other.parent == null;
+ } else return parent.equals(other.parent);
}
private SyncPDSSolver getOuterType() {
@@ -375,7 +372,7 @@ private SyncPDSSolver getOuterType() {
}
private class OnOutTransitionAddToStateListener extends WPAStateListener, W> {
- private Transition> nestedT;
+ private final Transition> nestedT;
public OnOutTransitionAddToStateListener(
INode state, Transition> nestedT) {
@@ -416,9 +413,8 @@ public boolean equals(Object obj) {
OnOutTransitionAddToStateListener other = (OnOutTransitionAddToStateListener) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (nestedT == null) {
- if (other.nestedT != null) return false;
- } else if (!nestedT.equals(other.nestedT)) return false;
- return true;
+ return other.nestedT == null;
+ } else return nestedT.equals(other.nestedT);
}
private SyncPDSSolver getOuterType() {
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSUpdateListener.java b/SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSUpdateListener.java
index 39305588..692be10d 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSUpdateListener.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/SyncPDSUpdateListener.java
@@ -11,10 +11,10 @@
*/
package sync.pds.solver;
+import de.fraunhofer.iem.Location;
import sync.pds.solver.nodes.Node;
-import wpds.interfaces.Location;
public interface SyncPDSUpdateListener {
- public void onReachableNodeAdded(Node reachableNode);
+ void onReachableNodeAdded(Node reachableNode);
}
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/SyncStatePDSUpdateListener.java b/SynchronizedPDS/src/main/java/sync/pds/solver/SyncStatePDSUpdateListener.java
index 26ad0b8c..d88de2e2 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/SyncStatePDSUpdateListener.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/SyncStatePDSUpdateListener.java
@@ -11,12 +11,12 @@
*/
package sync.pds.solver;
+import de.fraunhofer.iem.Location;
import sync.pds.solver.nodes.Node;
-import wpds.interfaces.Location;
public abstract class SyncStatePDSUpdateListener {
- private Node node;
+ private final Node node;
public SyncStatePDSUpdateListener(Node node) {
this.node = node;
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/WitnessListener.java b/SynchronizedPDS/src/main/java/sync/pds/solver/WitnessListener.java
index 026c9418..c064a6fa 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/WitnessListener.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/WitnessListener.java
@@ -11,10 +11,10 @@
*/
package sync.pds.solver;
+import de.fraunhofer.iem.Location;
import sync.pds.solver.nodes.INode;
import sync.pds.solver.nodes.Node;
import wpds.impl.Transition;
-import wpds.interfaces.Location;
public interface WitnessListener {
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/CallPopNode.java b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/CallPopNode.java
index e1bed0c4..91b549d3 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/CallPopNode.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/CallPopNode.java
@@ -41,8 +41,7 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
CallPopNode other = (CallPopNode) obj;
if (returnSite == null) {
- if (other.returnSite != null) return false;
- } else if (!returnSite.equals(other.returnSite)) return false;
- return true;
+ return other.returnSite == null;
+ } else return returnSite.equals(other.returnSite);
}
}
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/ExclusionNode.java b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/ExclusionNode.java
index 5b330b5a..460f7b7b 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/ExclusionNode.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/ExclusionNode.java
@@ -13,7 +13,7 @@
public class ExclusionNode extends Node {
- private Location exclusion;
+ private final Location exclusion;
public ExclusionNode(Stmt stmt, Fact variable, Location exclusion) {
super(stmt, variable);
@@ -35,9 +35,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
ExclusionNode other = (ExclusionNode) obj;
if (exclusion == null) {
- if (other.exclusion != null) return false;
- } else if (!exclusion.equals(other.exclusion)) return false;
- return true;
+ return other.exclusion == null;
+ } else return exclusion.equals(other.exclusion);
}
public Location exclusion() {
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/GeneratedState.java b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/GeneratedState.java
index 73076bd9..223fa06c 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/GeneratedState.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/GeneratedState.java
@@ -13,8 +13,8 @@
public class GeneratedState implements INode {
- private INode node;
- private N loc;
+ private final INode node;
+ private final N loc;
public GeneratedState(INode node, N loc) {
this.node = node;
@@ -59,8 +59,7 @@ public boolean equals(Object obj) {
if (other.loc != null) return false;
} else if (!loc.equals(other.loc)) return false;
if (node == null) {
- if (other.node != null) return false;
- } else if (!node.equals(other.node)) return false;
- return true;
+ return other.node == null;
+ } else return node.equals(other.node);
}
}
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/Node.java b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/Node.java
index 176728a3..baff8bd5 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/Node.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/Node.java
@@ -53,9 +53,8 @@ public boolean equals(Object obj) {
if (other.stmt != null) return false;
} else if (!stmt.equals(other.stmt)) return false;
if (variable == null) {
- if (other.variable != null) return false;
- } else if (!variable.equals(other.variable)) return false;
- return true;
+ return other.variable == null;
+ } else return variable.equals(other.variable);
}
@Override
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/NodeWithLocation.java b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/NodeWithLocation.java
index b7ef114f..f08a8df6 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/NodeWithLocation.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/NodeWithLocation.java
@@ -13,8 +13,8 @@
public class NodeWithLocation implements INode> {
- private Location loc;
- private Node fact;
+ private final Location loc;
+ private final Node fact;
public NodeWithLocation(Stmt stmt, Fact variable, Location loc) {
this.fact = new Node<>(stmt, variable);
@@ -49,9 +49,8 @@ public boolean equals(Object obj) {
if (other.fact != null) return false;
} else if (!fact.equals(other.fact)) return false;
if (loc == null) {
- if (other.loc != null) return false;
- } else if (!loc.equals(other.loc)) return false;
- return true;
+ return other.loc == null;
+ } else return loc.equals(other.loc);
}
@Override
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/PopNode.java b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/PopNode.java
index b8193dbf..834d1cf7 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/PopNode.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/PopNode.java
@@ -16,8 +16,8 @@
public class PopNode implements State {
- private PDSSystem system;
- private Location location;
+ private final PDSSystem system;
+ private final Location location;
public PopNode(Location location, PDSSystem system) {
this.system = system;
@@ -43,9 +43,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
PopNode other = (PopNode) obj;
if (location == null) {
- if (other.location != null) return false;
- } else if (!location.equals(other.location)) return false;
- return true;
+ return other.location == null;
+ } else return location.equals(other.location);
}
public Location location() {
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/PushNode.java b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/PushNode.java
index 8042426d..fd2904b5 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/PushNode.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/PushNode.java
@@ -15,8 +15,8 @@
public class PushNode extends Node {
- private PDSSystem system;
- private Location location;
+ private final PDSSystem system;
+ private final Location location;
public PushNode(Stmt stmt, Fact variable, Location location, PDSSystem system) {
super(stmt, variable);
@@ -47,9 +47,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
PushNode other = (PushNode) obj;
if (location == null) {
- if (other.location != null) return false;
- } else if (!location.equals(other.location)) return false;
- return true;
+ return other.location == null;
+ } else return location.equals(other.location);
}
@Override
diff --git a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/SingleNode.java b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/SingleNode.java
index de7bc31c..6c5767ee 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/SingleNode.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/solver/nodes/SingleNode.java
@@ -12,7 +12,7 @@
package sync.pds.solver.nodes;
public class SingleNode implements INode {
- private Fact fact;
+ private final Fact fact;
private int hashCode = 0;
public SingleNode(Fact fact) {
@@ -36,9 +36,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
SingleNode other = (SingleNode) obj;
if (fact == null) {
- if (other.fact != null) return false;
- } else if (!fact.equals(other.fact)) return false;
- return true;
+ return other.fact == null;
+ } else return fact.equals(other.fact);
}
@Override
diff --git a/SynchronizedPDS/src/main/java/sync/pds/weights/SetDomain.java b/SynchronizedPDS/src/main/java/sync/pds/weights/SetDomain.java
index 6cda318c..8793e952 100644
--- a/SynchronizedPDS/src/main/java/sync/pds/weights/SetDomain.java
+++ b/SynchronizedPDS/src/main/java/sync/pds/weights/SetDomain.java
@@ -12,11 +12,11 @@
package sync.pds.weights;
import com.google.common.collect.Sets;
+import de.fraunhofer.iem.Location;
import java.util.Collection;
import java.util.Set;
import sync.pds.solver.nodes.Node;
import wpds.impl.Weight;
-import wpds.interfaces.Location;
public class SetDomain extends Weight {
@@ -35,7 +35,7 @@ private SetDomain(Collection> nodes) {
}
public SetDomain(Node node) {
- this.nodes = Sets.>newHashSet(node);
+ this.nodes = Sets.newHashSet(node);
this.rep = null;
}
@@ -98,9 +98,8 @@ public boolean equals(Object obj) {
if (other.nodes != null) return false;
} else if (!nodes.equals(other.nodes)) return false;
if (rep == null) {
- if (other.rep != null) return false;
- } else if (!rep.equals(other.rep)) return false;
- return true;
+ return other.rep == null;
+ } else return rep.equals(other.rep);
}
public Collection> elements() {
diff --git a/SynchronizedPDS/src/test/java/analysis/test/DoublePDSTest.java b/SynchronizedPDS/src/test/java/analysis/test/DoublePDSTest.java
index ab799836..ca11785f 100644
--- a/SynchronizedPDS/src/test/java/analysis/test/DoublePDSTest.java
+++ b/SynchronizedPDS/src/test/java/analysis/test/DoublePDSTest.java
@@ -16,6 +16,9 @@
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
+import de.fraunhofer.iem.Location;
+import de.fraunhofer.iem.wildcard.ExclusionWildcard;
+import de.fraunhofer.iem.wildcard.Wildcard;
import java.util.Collection;
import org.junit.Test;
import org.slf4j.Logger;
@@ -32,15 +35,12 @@
import sync.pds.solver.nodes.SingleNode;
import wpds.impl.SummaryNestedWeightedPAutomatons;
import wpds.impl.Weight.NoWeight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
-import wpds.wildcard.ExclusionWildcard;
-import wpds.wildcard.Wildcard;
public class DoublePDSTest {
- private static Logger LOGGER = LoggerFactory.getLogger(DoublePDSTest.class);
- private Multimap, State> successorMap = HashMultimap.create();
- private Multimap, Node> summaryMap =
+ private static final Logger LOGGER = LoggerFactory.getLogger(DoublePDSTest.class);
+ private final Multimap, State> successorMap = HashMultimap.create();
+ private final Multimap, Node> summaryMap =
HashMultimap.create();
private void addFieldPop(
@@ -82,10 +82,11 @@ private void addExcludeField(
addSucc(curr, new ExclusionNode<>(succ.stmt(), succ.fact(), push));
}
- private FieldRef epsilonField = new FieldRef("EMPTY");
- private Statement epsilonCallSite = new Statement(-1);
+ private final FieldRef epsilonField = new FieldRef("EMPTY");
+ private final Statement epsilonCallSite = new Statement(-1);
- private SyncPDSSolver solver = new TestSyncPDSSolver();
+ private final SyncPDSSolver solver =
+ new TestSyncPDSSolver();
private class TestSyncPDSSolver extends SyncPDSSolver {
@@ -709,7 +710,7 @@ public ExclusionWildcardField(FieldRef excl) {
@Override
public FieldRef excludes() {
- return (FieldRef) excludes;
+ return excludes;
}
@Override
@@ -732,9 +733,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
ExclusionWildcardField other = (ExclusionWildcardField) obj;
if (excludes == null) {
- if (other.excludes != null) return false;
- } else if (!excludes.equals(other.excludes)) return false;
- return true;
+ return other.excludes == null;
+ } else return excludes.equals(other.excludes);
}
}
@@ -771,9 +771,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
StringBasedObj other = (StringBasedObj) obj;
if (name == null) {
- if (other.name != null) return false;
- } else if (!name.equals(other.name)) return false;
- return true;
+ return other.name == null;
+ } else return name.equals(other.name);
}
@Override
diff --git a/WPDS/pom.xml b/WPDS/pom.xml
index b092f985..fc4c11c2 100644
--- a/WPDS/pom.xml
+++ b/WPDS/pom.xml
@@ -8,6 +8,10 @@
4.0.0
WPDS
+
+ de.fraunhofer.iem
+ PDS
+
junit
junit
diff --git a/WPDS/src/main/java/wpds/debug/Debugger.java b/WPDS/src/main/java/wpds/debug/Debugger.java
index 0925cd7f..ee8a70f0 100644
--- a/WPDS/src/main/java/wpds/debug/Debugger.java
+++ b/WPDS/src/main/java/wpds/debug/Debugger.java
@@ -11,8 +11,8 @@
*/
package wpds.debug;
+import de.fraunhofer.iem.Location;
import wpds.impl.Weight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public interface Debugger {}
diff --git a/WPDS/src/main/java/wpds/impl/Configuration.java b/WPDS/src/main/java/wpds/impl/Configuration.java
index 97d43fc1..4d90515a 100644
--- a/WPDS/src/main/java/wpds/impl/Configuration.java
+++ b/WPDS/src/main/java/wpds/impl/Configuration.java
@@ -11,12 +11,12 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public class Configuration {
- private D state;
- private N location;
+ private final D state;
+ private final N location;
public Configuration(N location, D state) {
this.location = location;
@@ -42,8 +42,7 @@ public boolean equals(Object obj) {
if (other.location != null) return false;
} else if (!location.equals(other.location)) return false;
if (state == null) {
- if (other.state != null) return false;
- } else if (!state.equals(other.state)) return false;
- return true;
+ return other.state == null;
+ } else return state.equals(other.state);
}
}
diff --git a/WPDS/src/main/java/wpds/impl/ConnectPushListener.java b/WPDS/src/main/java/wpds/impl/ConnectPushListener.java
index 8f15241c..1d4ce218 100644
--- a/WPDS/src/main/java/wpds/impl/ConnectPushListener.java
+++ b/WPDS/src/main/java/wpds/impl/ConnectPushListener.java
@@ -11,7 +11,7 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public interface ConnectPushListener {
diff --git a/WPDS/src/main/java/wpds/impl/NestedAutomatonListener.java b/WPDS/src/main/java/wpds/impl/NestedAutomatonListener.java
index 3f126ac6..08d62120 100644
--- a/WPDS/src/main/java/wpds/impl/NestedAutomatonListener.java
+++ b/WPDS/src/main/java/wpds/impl/NestedAutomatonListener.java
@@ -11,7 +11,7 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public interface NestedAutomatonListener {
diff --git a/WPDS/src/main/java/wpds/impl/NestedWeightedPAutomatons.java b/WPDS/src/main/java/wpds/impl/NestedWeightedPAutomatons.java
index 631f69ca..10ad4cd2 100644
--- a/WPDS/src/main/java/wpds/impl/NestedWeightedPAutomatons.java
+++ b/WPDS/src/main/java/wpds/impl/NestedWeightedPAutomatons.java
@@ -11,7 +11,7 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public interface NestedWeightedPAutomatons {
diff --git a/WPDS/src/main/java/wpds/impl/NormalRule.java b/WPDS/src/main/java/wpds/impl/NormalRule.java
index 0c0ef18f..6726c20d 100644
--- a/WPDS/src/main/java/wpds/impl/NormalRule.java
+++ b/WPDS/src/main/java/wpds/impl/NormalRule.java
@@ -11,7 +11,7 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public class NormalRule
diff --git a/WPDS/src/main/java/wpds/impl/PAutomaton.java b/WPDS/src/main/java/wpds/impl/PAutomaton.java
index 9bb9777f..227c1cfe 100644
--- a/WPDS/src/main/java/wpds/impl/PAutomaton.java
+++ b/WPDS/src/main/java/wpds/impl/PAutomaton.java
@@ -11,9 +11,9 @@
*/
package wpds.impl;
+import de.fraunhofer.iem.Location;
import pathexpression.LabeledGraph;
import wpds.impl.Weight.NoWeight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public abstract class PAutomaton
diff --git a/WPDS/src/main/java/wpds/impl/PopRule.java b/WPDS/src/main/java/wpds/impl/PopRule.java
index cf3adbb7..b65a3316 100644
--- a/WPDS/src/main/java/wpds/impl/PopRule.java
+++ b/WPDS/src/main/java/wpds/impl/PopRule.java
@@ -11,7 +11,7 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public class PopRule extends Rule {
diff --git a/WPDS/src/main/java/wpds/impl/PostStar.java b/WPDS/src/main/java/wpds/impl/PostStar.java
index f4f1e7d6..eb2691ab 100644
--- a/WPDS/src/main/java/wpds/impl/PostStar.java
+++ b/WPDS/src/main/java/wpds/impl/PostStar.java
@@ -11,15 +11,15 @@
*/
package wpds.impl;
-import wpds.interfaces.Empty;
+import de.fraunhofer.iem.Empty;
+import de.fraunhofer.iem.Location;
+import de.fraunhofer.iem.wildcard.ExclusionWildcard;
+import de.fraunhofer.iem.wildcard.Wildcard;
import wpds.interfaces.IPushdownSystem;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
import wpds.interfaces.WPAStateListener;
import wpds.interfaces.WPAUpdateListener;
import wpds.interfaces.WPDSUpdateListener;
-import wpds.wildcard.ExclusionWildcard;
-import wpds.wildcard.Wildcard;
public abstract class PostStar {
private IPushdownSystem pds;
@@ -34,7 +34,7 @@ public void poststar(IPushdownSystem pds, WeightedPAutomaton i
private class PostStarUpdateListener implements WPDSUpdateListener {
- private WeightedPAutomaton aut;
+ private final WeightedPAutomaton aut;
public PostStarUpdateListener(WeightedPAutomaton fa) {
aut = fa;
@@ -67,17 +67,16 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
PostStarUpdateListener other = (PostStarUpdateListener) obj;
if (aut == null) {
- if (other.aut != null) return false;
- } else if (!aut.equals(other.aut)) return false;
- return true;
+ return other.aut == null;
+ } else return aut.equals(other.aut);
}
}
private class UpdateTransitivePopListener extends WPAStateListener {
- private D start;
- private N label;
- private W newWeight;
+ private final D start;
+ private final N label;
+ private final W newWeight;
public UpdateTransitivePopListener(D start, N label, D target, W newWeight) {
super(target);
@@ -118,16 +117,15 @@ public boolean equals(Object obj) {
if (other.newWeight != null) return false;
} else if (!newWeight.equals(other.newWeight)) return false;
if (label == null) {
- if (other.label != null) return false;
- } else if (!label.equals(other.label)) return false;
- return true;
+ return other.label == null;
+ } else return label.equals(other.label);
}
}
private class HandlePopListener extends WPAStateListener {
- private N popLabel;
- private D targetState;
- private W ruleWeight;
+ private final N popLabel;
+ private final D targetState;
+ private final W ruleWeight;
public HandlePopListener(D state, N popLabel, D targetState, W ruleWeight) {
super(state);
@@ -192,14 +190,13 @@ public boolean equals(Object obj) {
if (other.ruleWeight != null) return false;
} else if (!ruleWeight.equals(other.ruleWeight)) return false;
if (targetState == null) {
- if (other.targetState != null) return false;
- } else if (!targetState.equals(other.targetState)) return false;
- return true;
+ return other.targetState == null;
+ } else return targetState.equals(other.targetState);
}
}
private class HandleNormalListener extends WPAStateListener {
- private NormalRule rule;
+ private final NormalRule rule;
public HandleNormalListener(NormalRule rule) {
super(rule.getS1());
@@ -247,14 +244,13 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
HandleNormalListener other = (HandleNormalListener) obj;
if (rule == null) {
- if (other.rule != null) return false;
- } else if (!rule.equals(other.rule)) return false;
- return true;
+ return other.rule == null;
+ } else return rule.equals(other.rule);
}
}
private class HandlePushListener extends WPAStateListener {
- private PushRule rule;
+ private final PushRule rule;
public HandlePushListener(PushRule rule) {
super(rule.getS1());
@@ -291,7 +287,7 @@ public void onOutTransitionAdded(
public void onWeightAdded(
Transition t, W w, WeightedPAutomaton innerAut) {
if ((t.getLabel().equals(fa.epsilon()) && t.getTarget().equals(irState))) {
- update(t, (W) w);
+ update(t, w);
W newWeight = getWeightFor(callSiteTransition);
update(
@@ -326,9 +322,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
HandlePushListener other = (HandlePushListener) obj;
if (rule == null) {
- if (other.rule != null) return false;
- } else if (!rule.equals(other.rule)) return false;
- return true;
+ return other.rule == null;
+ } else return rule.equals(other.rule);
}
}
diff --git a/WPDS/src/main/java/wpds/impl/PreStar.java b/WPDS/src/main/java/wpds/impl/PreStar.java
index 4d2d1444..63efe2af 100644
--- a/WPDS/src/main/java/wpds/impl/PreStar.java
+++ b/WPDS/src/main/java/wpds/impl/PreStar.java
@@ -13,12 +13,12 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import de.fraunhofer.iem.Location;
+import de.fraunhofer.iem.wildcard.Wildcard;
import java.util.LinkedList;
import java.util.List;
import wpds.interfaces.IPushdownSystem;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
-import wpds.wildcard.Wildcard;
public class PreStar {
private LinkedList> worklist = Lists.newLinkedList();
@@ -39,7 +39,7 @@ public WeightedPAutomaton prestar(
update(
new Transition(r.getS1(), r.getL1(), r.getS2()),
r.getWeight(),
- Lists.>newLinkedList());
+ Lists.newLinkedList());
}
while (!worklist.isEmpty()) {
@@ -47,7 +47,7 @@ public WeightedPAutomaton prestar(
for (NormalRule r : pds.getNormalRulesEnding(t.getStart(), t.getLabel())) {
// Normal rules
- LinkedList> previous = Lists.>newLinkedList();
+ LinkedList> previous = Lists.newLinkedList();
previous.add(t);
update(new Transition(r.getS1(), r.getL1(), t.getTarget()), r.getWeight(), previous);
}
@@ -55,7 +55,7 @@ public WeightedPAutomaton prestar(
// Push rules
for (Transition tdash : Sets.newHashSet(fa.getTransitions())) {
if (tdash.getLabel().equals(r.getCallSite())) {
- LinkedList> previous = Lists.>newLinkedList();
+ LinkedList> previous = Lists.newLinkedList();
previous.add(t);
previous.add(tdash);
update(
@@ -63,7 +63,7 @@ public WeightedPAutomaton prestar(
r.getWeight(),
previous);
} else if (r.getCallSite() instanceof Wildcard) {
- LinkedList> previous = Lists.>newLinkedList();
+ LinkedList> previous = Lists.newLinkedList();
previous.add(t);
previous.add(tdash);
update(
@@ -82,7 +82,7 @@ public WeightedPAutomaton prestar(
if (!fa.getTransitions().contains(tdash)) {
continue;
}
- LinkedList> previous = Lists.>newLinkedList();
+ LinkedList> previous = Lists.newLinkedList();
previous.add(tdash);
previous.add(t);
N label = ((r.getCallSite() instanceof Wildcard) ? t.getLabel() : r.getL1());
@@ -110,9 +110,8 @@ private void update(Transition trans, W weight, List> pre
private W getOrCreateWeight(Transition trans) {
W w = fa.getWeightFor(trans);
- if (w != null) return w;
+ return w;
// z.setRange(trans.getLabel(), trans.getLabel());
- return null;
}
}
diff --git a/WPDS/src/main/java/wpds/impl/PrefixImport.java b/WPDS/src/main/java/wpds/impl/PrefixImport.java
index dd9fc93f..93cfcd98 100644
--- a/WPDS/src/main/java/wpds/impl/PrefixImport.java
+++ b/WPDS/src/main/java/wpds/impl/PrefixImport.java
@@ -1,6 +1,6 @@
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
import wpds.interfaces.WPAStateListener;
@@ -49,7 +49,7 @@ public void trigger(Transition baseT, Transition flowT) {
private class Import extends WPAStateListener {
- private D flowTarget;
+ private final D flowTarget;
public Import(D state, D flowTarget) {
super(state);
@@ -84,9 +84,8 @@ public boolean equals(Object obj) {
Import other = (Import) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (flowTarget == null) {
- if (other.flowTarget != null) return false;
- } else if (!flowTarget.equals(other.flowTarget)) return false;
- return true;
+ return other.flowTarget == null;
+ } else return flowTarget.equals(other.flowTarget);
}
private PrefixImport getOuterType() {
@@ -96,9 +95,9 @@ private PrefixImport getOuterType() {
private class IntersectionListener extends WPAStateListener {
- private D flowState;
- private N label;
- private IntersectionCallback callback;
+ private final D flowState;
+ private final N label;
+ private final IntersectionCallback callback;
public IntersectionListener(D baseState, D flowState, N label, IntersectionCallback callback) {
super(baseState);
@@ -139,9 +138,8 @@ public boolean equals(Object obj) {
if (other.flowState != null) return false;
} else if (!flowState.equals(other.flowState)) return false;
if (label == null) {
- if (other.label != null) return false;
- } else if (!label.equals(other.label)) return false;
- return true;
+ return other.label == null;
+ } else return label.equals(other.label);
}
private PrefixImport getOuterType() {
@@ -189,9 +187,8 @@ public boolean equals(Object obj) {
HasOutTransWithSameLabel other = (HasOutTransWithSameLabel) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (baseT == null) {
- if (other.baseT != null) return false;
- } else if (!baseT.equals(other.baseT)) return false;
- return true;
+ return other.baseT == null;
+ } else return baseT.equals(other.baseT);
}
private PrefixImport getOuterType() {
@@ -201,8 +198,8 @@ private PrefixImport getOuterType() {
private class IntersectionListenerNoLabel extends WPAStateListener {
- private D flowState;
- private IntersectionCallback callback;
+ private final D flowState;
+ private final IntersectionCallback callback;
public IntersectionListenerNoLabel(D baseState, D flowState, IntersectionCallback callback) {
super(baseState);
@@ -237,9 +234,8 @@ public boolean equals(Object obj) {
IntersectionListenerNoLabel other = (IntersectionListenerNoLabel) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (flowState == null) {
- if (other.flowState != null) return false;
- } else if (!flowState.equals(other.flowState)) return false;
- return true;
+ return other.flowState == null;
+ } else return flowState.equals(other.flowState);
}
private PrefixImport getOuterType() {
diff --git a/WPDS/src/main/java/wpds/impl/PushRule.java b/WPDS/src/main/java/wpds/impl/PushRule.java
index 574b3b90..8f1bf01d 100644
--- a/WPDS/src/main/java/wpds/impl/PushRule.java
+++ b/WPDS/src/main/java/wpds/impl/PushRule.java
@@ -11,7 +11,7 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public class PushRule extends Rule {
@@ -42,9 +42,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
PushRule other = (PushRule) obj;
if (callSite == null) {
- if (other.callSite != null) return false;
- } else if (!callSite.equals(other.callSite)) return false;
- return true;
+ return other.callSite == null;
+ } else return callSite.equals(other.callSite);
}
@Override
diff --git a/WPDS/src/main/java/wpds/impl/PushdownSystem.java b/WPDS/src/main/java/wpds/impl/PushdownSystem.java
index 57af9cd1..cf313f39 100644
--- a/WPDS/src/main/java/wpds/impl/PushdownSystem.java
+++ b/WPDS/src/main/java/wpds/impl/PushdownSystem.java
@@ -11,8 +11,8 @@
*/
package wpds.impl;
+import de.fraunhofer.iem.Location;
import wpds.impl.Weight.NoWeight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public class PushdownSystem
diff --git a/WPDS/src/main/java/wpds/impl/Rule.java b/WPDS/src/main/java/wpds/impl/Rule.java
index 09f8f7b4..d6eebb66 100644
--- a/WPDS/src/main/java/wpds/impl/Rule.java
+++ b/WPDS/src/main/java/wpds/impl/Rule.java
@@ -11,7 +11,7 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public abstract class Rule {
@@ -92,8 +92,7 @@ public boolean equals(Object obj) {
if (other.s2 != null) return false;
} else if (!s2.equals(other.s2)) return false;
if (w == null) {
- if (other.w != null) return false;
- } else if (!w.equals(other.w)) return false;
- return true;
+ return other.w == null;
+ } else return w.equals(other.w);
}
}
diff --git a/WPDS/src/main/java/wpds/impl/StackListener.java b/WPDS/src/main/java/wpds/impl/StackListener.java
index 19372ae8..98503bc1 100644
--- a/WPDS/src/main/java/wpds/impl/StackListener.java
+++ b/WPDS/src/main/java/wpds/impl/StackListener.java
@@ -1,8 +1,8 @@
package wpds.impl;
import com.google.common.collect.Sets;
+import de.fraunhofer.iem.Location;
import java.util.Set;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
import wpds.interfaces.WPAStateListener;
@@ -11,8 +11,8 @@ public abstract class StackListener aut;
- private N source;
- private Set notifiedStacks = Sets.newHashSet();
+ private final N source;
+ private final Set notifiedStacks = Sets.newHashSet();
public StackListener(WeightedPAutomaton weightedPAutomaton, D state, N source) {
super(state);
@@ -58,13 +58,12 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
StackListener other = (StackListener) obj;
if (source == null) {
- if (other.source != null) return false;
- } else if (!source.equals(other.source)) return false;
- return true;
+ return other.source == null;
+ } else return source.equals(other.source);
}
private class SubStackListener extends WPAStateListener {
- private StackListener parent;
+ private final StackListener parent;
public SubStackListener(D state, StackListener parent) {
super(state);
@@ -106,9 +105,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
SubStackListener other = (SubStackListener) obj;
if (parent == null) {
- if (other.parent != null) return false;
- } else if (!parent.equals(other.parent)) return false;
- return true;
+ return other.parent == null;
+ } else return parent.equals(other.parent);
}
}
}
diff --git a/WPDS/src/main/java/wpds/impl/SummaryNestedWeightedPAutomatons.java b/WPDS/src/main/java/wpds/impl/SummaryNestedWeightedPAutomatons.java
index 17f0be6b..46a4e811 100644
--- a/WPDS/src/main/java/wpds/impl/SummaryNestedWeightedPAutomatons.java
+++ b/WPDS/src/main/java/wpds/impl/SummaryNestedWeightedPAutomatons.java
@@ -12,14 +12,14 @@
package wpds.impl;
import com.google.common.collect.Maps;
+import de.fraunhofer.iem.Location;
import java.util.Map;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public class SummaryNestedWeightedPAutomatons
implements NestedWeightedPAutomatons {
- private Map> summaries = Maps.newHashMap();
+ private final Map> summaries = Maps.newHashMap();
@Override
public void putSummaryAutomaton(D target, WeightedPAutomaton aut) {
diff --git a/WPDS/src/main/java/wpds/impl/Transition.java b/WPDS/src/main/java/wpds/impl/Transition.java
index 72285a7e..3d7801d1 100644
--- a/WPDS/src/main/java/wpds/impl/Transition.java
+++ b/WPDS/src/main/java/wpds/impl/Transition.java
@@ -11,10 +11,10 @@
*/
package wpds.impl;
+import de.fraunhofer.iem.Location;
+import de.fraunhofer.iem.wildcard.Wildcard;
import pathexpression.Edge;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
-import wpds.wildcard.Wildcard;
public class Transition implements Edge {
private final D s1;
@@ -69,9 +69,8 @@ public boolean equals(Object obj) {
if (other.s1 != null) return false;
} else if (!s1.equals(other.s1)) return false;
if (s2 == null) {
- if (other.s2 != null) return false;
- } else if (!s2.equals(other.s2)) return false;
- return true;
+ return other.s2 == null;
+ } else return s2.equals(other.s2);
}
@Override
diff --git a/WPDS/src/main/java/wpds/impl/UNormalRule.java b/WPDS/src/main/java/wpds/impl/UNormalRule.java
index 9e92c21f..3ef92d4a 100644
--- a/WPDS/src/main/java/wpds/impl/UNormalRule.java
+++ b/WPDS/src/main/java/wpds/impl/UNormalRule.java
@@ -11,8 +11,8 @@
*/
package wpds.impl;
+import de.fraunhofer.iem.Location;
import wpds.impl.Weight.NoWeight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public class UNormalRule extends NormalRule {
diff --git a/WPDS/src/main/java/wpds/impl/UPopRule.java b/WPDS/src/main/java/wpds/impl/UPopRule.java
index c4e7dc33..e118478e 100644
--- a/WPDS/src/main/java/wpds/impl/UPopRule.java
+++ b/WPDS/src/main/java/wpds/impl/UPopRule.java
@@ -11,8 +11,8 @@
*/
package wpds.impl;
+import de.fraunhofer.iem.Location;
import wpds.impl.Weight.NoWeight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public class UPopRule extends PopRule {
diff --git a/WPDS/src/main/java/wpds/impl/UPushRule.java b/WPDS/src/main/java/wpds/impl/UPushRule.java
index c7425bcd..bb1c2c0a 100644
--- a/WPDS/src/main/java/wpds/impl/UPushRule.java
+++ b/WPDS/src/main/java/wpds/impl/UPushRule.java
@@ -11,8 +11,8 @@
*/
package wpds.impl;
+import de.fraunhofer.iem.Location;
import wpds.impl.Weight.NoWeight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public class UPushRule extends PushRule {
diff --git a/WPDS/src/main/java/wpds/impl/UnbalancedPopListener.java b/WPDS/src/main/java/wpds/impl/UnbalancedPopListener.java
index 500b3460..9e38d0cb 100644
--- a/WPDS/src/main/java/wpds/impl/UnbalancedPopListener.java
+++ b/WPDS/src/main/java/wpds/impl/UnbalancedPopListener.java
@@ -11,7 +11,7 @@
*/
package wpds.impl;
-import wpds.interfaces.Location;
+import de.fraunhofer.iem.Location;
import wpds.interfaces.State;
public interface UnbalancedPopListener {
diff --git a/WPDS/src/main/java/wpds/impl/WeightedPAutomaton.java b/WPDS/src/main/java/wpds/impl/WeightedPAutomaton.java
index 6c16a79d..167244d2 100644
--- a/WPDS/src/main/java/wpds/impl/WeightedPAutomaton.java
+++ b/WPDS/src/main/java/wpds/impl/WeightedPAutomaton.java
@@ -20,6 +20,7 @@
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import com.google.common.collect.Table;
+import de.fraunhofer.iem.Location;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -38,7 +39,6 @@
import pathexpression.RegEx;
import wpds.interfaces.ForwardDFSEpsilonVisitor;
import wpds.interfaces.ForwardDFSVisitor;
-import wpds.interfaces.Location;
import wpds.interfaces.ReachabilityListener;
import wpds.interfaces.State;
import wpds.interfaces.WPAStateListener;
@@ -47,7 +47,7 @@
public abstract class WeightedPAutomaton
implements LabeledGraph {
private static final Logger LOGGER = LoggerFactory.getLogger(WeightedPAutomaton.class);
- private Map, W> transitionToWeights = new HashMap<>();
+ private final Map, W> transitionToWeights = new HashMap<>();
// Set Q is implicit
// Weighted Pushdown Systems and their Application to Interprocedural
// Dataflow Analysis
@@ -59,19 +59,20 @@ public abstract class WeightedPAutomaton states = Sets.newHashSet();
private final Multimap> transitionsOutOf = HashMultimap.create();
private final Multimap> transitionsInto = HashMultimap.create();
- private Set> listeners = Sets.newHashSet();
- private Multimap> stateListeners = HashMultimap.create();
- private Map> stateToDFS = Maps.newHashMap();
- private Map> stateToEpsilonDFS = Maps.newHashMap();
- private Set> nestedAutomatons = Sets.newHashSet();
- private Set> nestedAutomataListeners = Sets.newHashSet();
- private Map> stateToEpsilonReachabilityListener = Maps.newHashMap();
- private Map> stateToReachabilityListener = Maps.newHashMap();
- private Set connectedPushes = Sets.newHashSet();
- private Set> conntectedPushListeners = Sets.newHashSet();
- private Set> unbalancedPopListeners = Sets.newHashSet();
- private Map unbalancedPops = Maps.newHashMap();
- private Map, W> transitionsToFinalWeights = Maps.newHashMap();
+ private final Set> listeners = Sets.newHashSet();
+ private final Multimap> stateListeners = HashMultimap.create();
+ private final Map> stateToDFS = Maps.newHashMap();
+ private final Map> stateToEpsilonDFS = Maps.newHashMap();
+ private final Set> nestedAutomatons = Sets.newHashSet();
+ private final Set> nestedAutomataListeners = Sets.newHashSet();
+ private final Map> stateToEpsilonReachabilityListener =
+ Maps.newHashMap();
+ private final Map> stateToReachabilityListener = Maps.newHashMap();
+ private final Set connectedPushes = Sets.newHashSet();
+ private final Set> conntectedPushListeners = Sets.newHashSet();
+ private final Set> unbalancedPopListeners = Sets.newHashSet();
+ private final Map unbalancedPops = Maps.newHashMap();
+ private final Map, W> transitionsToFinalWeights = Maps.newHashMap();
private ForwardDFSVisitor dfsVisitor;
private ForwardDFSVisitor dfsEpsVisitor;
public int failedAdditions;
@@ -79,9 +80,9 @@ public abstract class WeightedPAutomaton initialAutomaton;
private PathExpressionComputer pathExpressionComputer;
private int lastStates = 0;
- private Stopwatch watch = Stopwatch.createUnstarted();
- private Map stateToDistanceToInitial = Maps.newHashMap();
- private Map stateToUnbalancedDistance = Maps.newHashMap();
+ private final Stopwatch watch = Stopwatch.createUnstarted();
+ private final Map stateToDistanceToInitial = Maps.newHashMap();
+ private final Map stateToUnbalancedDistance = Maps.newHashMap();
private final Map> stateCreatingTransition = Maps.newHashMap();
public abstract D createState(D d, N loc);
@@ -123,13 +124,13 @@ private String wrapIfInitialOrFinalState(D s) {
}
private String wrapFinalState(D s) {
- return finalState.contains(s) ? "TO: " + s + "" : s.toString();
+ return finalState.contains(s) ? "TO: " + s : s.toString();
}
private static final boolean SUMMARIZE = false;
public String toDotString() {
- return toDotString(Sets.>newHashSet());
+ return toDotString(Sets.newHashSet());
}
private String toDotString(Set> visited) {
@@ -257,7 +258,7 @@ public IRegEx extractLanguage(D from) {
if (res == null) {
res = regEx;
} else {
- res = RegEx.union(res, regEx);
+ res = RegEx.union(res, regEx);
}
}
if (res == null) return new RegEx.EmptySet();
@@ -498,8 +499,8 @@ public void unbalancedPop(D targetState, Transition trans, W weight) {
}
}
- private Set> summaryEdges = Sets.newHashSet();
- private Set> summaryEdgeListener = Sets.newHashSet();
+ private final Set> summaryEdges = Sets.newHashSet();
+ private final Set> summaryEdgeListener = Sets.newHashSet();
public void registerSummaryEdge(Transition t) {
if (summaryEdges.add(t)) {
@@ -555,9 +556,8 @@ public boolean equals(Object obj) {
if (other.targetState != null) return false;
} else if (!targetState.equals(other.targetState)) return false;
if (trans == null) {
- if (other.trans != null) return false;
- } else if (!trans.equals(other.trans)) return false;
- return true;
+ return other.trans == null;
+ } else return trans.equals(other.trans);
}
private WeightedPAutomaton getOuterType() {
@@ -601,9 +601,8 @@ public boolean equals(Object obj) {
if (other.returnedFact != null) return false;
} else if (!returnedFact.equals(other.returnedFact)) return false;
if (returnedWeight == null) {
- if (other.returnedWeight != null) return false;
- } else if (!returnedWeight.equals(other.returnedWeight)) return false;
- return true;
+ return other.returnedWeight == null;
+ } else return returnedWeight.equals(other.returnedWeight);
}
private WeightedPAutomaton getOuterType() {
@@ -623,7 +622,7 @@ public Map, W> getTransitionsToFinalWeights() {
private class ValueComputationListener extends WPAStateListener {
- private W weight;
+ private final W weight;
public ValueComputationListener(D state, W weight) {
super(state);
@@ -661,9 +660,8 @@ public boolean equals(Object obj) {
ValueComputationListener other = (ValueComputationListener) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (weight == null) {
- if (other.weight != null) return false;
- } else if (!weight.equals(other.weight)) return false;
- return true;
+ return other.weight == null;
+ } else return weight.equals(other.weight);
}
private WeightedPAutomaton getOuterType() {
diff --git a/WPDS/src/main/java/wpds/impl/WeightedPushdownSystem.java b/WPDS/src/main/java/wpds/impl/WeightedPushdownSystem.java
index 41d3e356..b7aa3a2f 100644
--- a/WPDS/src/main/java/wpds/impl/WeightedPushdownSystem.java
+++ b/WPDS/src/main/java/wpds/impl/WeightedPushdownSystem.java
@@ -14,13 +14,13 @@
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import de.fraunhofer.iem.Location;
+import de.fraunhofer.iem.wildcard.Wildcard;
import java.util.HashSet;
import java.util.Set;
import wpds.interfaces.IPushdownSystem;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
import wpds.interfaces.WPDSUpdateListener;
-import wpds.wildcard.Wildcard;
public class WeightedPushdownSystem
implements IPushdownSystem {
diff --git a/WPDS/src/main/java/wpds/interfaces/ForwardDFSEpsilonVisitor.java b/WPDS/src/main/java/wpds/interfaces/ForwardDFSEpsilonVisitor.java
index 7319381c..23cf3a12 100644
--- a/WPDS/src/main/java/wpds/interfaces/ForwardDFSEpsilonVisitor.java
+++ b/WPDS/src/main/java/wpds/interfaces/ForwardDFSEpsilonVisitor.java
@@ -11,6 +11,8 @@
*/
package wpds.interfaces;
+import de.fraunhofer.iem.Empty;
+import de.fraunhofer.iem.Location;
import wpds.impl.Transition;
import wpds.impl.Weight;
import wpds.impl.WeightedPAutomaton;
diff --git a/WPDS/src/main/java/wpds/interfaces/ForwardDFSVisitor.java b/WPDS/src/main/java/wpds/interfaces/ForwardDFSVisitor.java
index 99f2ba5d..6309ac55 100644
--- a/WPDS/src/main/java/wpds/interfaces/ForwardDFSVisitor.java
+++ b/WPDS/src/main/java/wpds/interfaces/ForwardDFSVisitor.java
@@ -16,6 +16,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.Table;
+import de.fraunhofer.iem.Location;
import java.util.LinkedList;
import wpds.impl.Transition;
import wpds.impl.Weight;
@@ -23,12 +24,12 @@
public class ForwardDFSVisitor
implements WPAUpdateListener {
- private Multimap> listeners = HashMultimap.create();
+ private final Multimap> listeners = HashMultimap.create();
protected WeightedPAutomaton aut;
- private Multimap adjacent = HashMultimap.create();
- private Multimap reaches = HashMultimap.create();
- private Multimap inverseReaches = HashMultimap.create();
- private Table refCount = HashBasedTable.create();
+ private final Multimap adjacent = HashMultimap.create();
+ private final Multimap reaches = HashMultimap.create();
+ private final Multimap inverseReaches = HashMultimap.create();
+ private final Table refCount = HashBasedTable.create();
public ForwardDFSVisitor(WeightedPAutomaton aut) {
this.aut = aut;
@@ -44,8 +45,8 @@ public void registerListener(D state, final ReachabilityListener l) {
private class TransitiveClosure extends WPAStateListener {
- private ReachabilityListener listener;
- private D s;
+ private final ReachabilityListener listener;
+ private final D s;
public TransitiveClosure(D state, D s, ReachabilityListener l) {
super(state);
@@ -82,9 +83,8 @@ public boolean equals(Object obj) {
if (other.s != null) return false;
} else if (!s.equals(other.s)) return false;
if (listener == null) {
- if (other.listener != null) return false;
- } else if (!listener.equals(other.listener)) return false;
- return true;
+ return other.listener == null;
+ } else return listener.equals(other.listener);
}
private ForwardDFSVisitor getOuterType() {
@@ -188,9 +188,8 @@ public boolean equals(Object obj) {
if (other.from != null) return false;
} else if (!from.equals(other.from)) return false;
if (to == null) {
- if (other.to != null) return false;
- } else if (!to.equals(other.to)) return false;
- return true;
+ return other.to == null;
+ } else return to.equals(other.to);
}
}
@@ -209,8 +208,7 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
ForwardDFSVisitor other = (ForwardDFSVisitor) obj;
if (aut == null) {
- if (other.aut != null) return false;
- } else if (!aut.equals(other.aut)) return false;
- return true;
+ return other.aut == null;
+ } else return aut.equals(other.aut);
}
}
diff --git a/WPDS/src/main/java/wpds/interfaces/IPushdownSystem.java b/WPDS/src/main/java/wpds/interfaces/IPushdownSystem.java
index 3ad67fd3..de57068e 100644
--- a/WPDS/src/main/java/wpds/interfaces/IPushdownSystem.java
+++ b/WPDS/src/main/java/wpds/interfaces/IPushdownSystem.java
@@ -11,6 +11,7 @@
*/
package wpds.interfaces;
+import de.fraunhofer.iem.Location;
import java.util.Set;
import wpds.impl.NestedWeightedPAutomatons;
import wpds.impl.NormalRule;
diff --git a/WPDS/src/main/java/wpds/interfaces/ReachabilityListener.java b/WPDS/src/main/java/wpds/interfaces/ReachabilityListener.java
index 802a603c..904a9869 100644
--- a/WPDS/src/main/java/wpds/interfaces/ReachabilityListener.java
+++ b/WPDS/src/main/java/wpds/interfaces/ReachabilityListener.java
@@ -11,6 +11,7 @@
*/
package wpds.interfaces;
+import de.fraunhofer.iem.Location;
import wpds.impl.Transition;
public interface ReachabilityListener {
diff --git a/WPDS/src/main/java/wpds/interfaces/WPAStateListener.java b/WPDS/src/main/java/wpds/interfaces/WPAStateListener.java
index d05ff97c..aeaddec3 100644
--- a/WPDS/src/main/java/wpds/interfaces/WPAStateListener.java
+++ b/WPDS/src/main/java/wpds/interfaces/WPAStateListener.java
@@ -11,6 +11,7 @@
*/
package wpds.interfaces;
+import de.fraunhofer.iem.Location;
import wpds.impl.Transition;
import wpds.impl.Weight;
import wpds.impl.WeightedPAutomaton;
@@ -48,8 +49,7 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
WPAStateListener other = (WPAStateListener) obj;
if (state == null) {
- if (other.state != null) return false;
- } else if (!state.equals(other.state)) return false;
- return true;
+ return other.state == null;
+ } else return state.equals(other.state);
}
}
diff --git a/WPDS/src/main/java/wpds/interfaces/WPAUpdateListener.java b/WPDS/src/main/java/wpds/interfaces/WPAUpdateListener.java
index c2f5652b..8e382517 100644
--- a/WPDS/src/main/java/wpds/interfaces/WPAUpdateListener.java
+++ b/WPDS/src/main/java/wpds/interfaces/WPAUpdateListener.java
@@ -11,6 +11,7 @@
*/
package wpds.interfaces;
+import de.fraunhofer.iem.Location;
import wpds.impl.Transition;
import wpds.impl.Weight;
import wpds.impl.WeightedPAutomaton;
diff --git a/WPDS/src/main/java/wpds/interfaces/WPDSUpdateListener.java b/WPDS/src/main/java/wpds/interfaces/WPDSUpdateListener.java
index 043cf9a2..89af7fcb 100644
--- a/WPDS/src/main/java/wpds/interfaces/WPDSUpdateListener.java
+++ b/WPDS/src/main/java/wpds/interfaces/WPDSUpdateListener.java
@@ -11,10 +11,11 @@
*/
package wpds.interfaces;
+import de.fraunhofer.iem.Location;
import wpds.impl.Rule;
import wpds.impl.Weight;
public interface WPDSUpdateListener {
- public void onRuleAdded(Rule rule);
+ void onRuleAdded(Rule rule);
}
diff --git a/WPDS/src/main/java/wpds/wildcard/WildcardPushdownSystem.java b/WPDS/src/main/java/wpds/wildcard/WildcardPushdownSystem.java
index 4b5428f7..1a353286 100644
--- a/WPDS/src/main/java/wpds/wildcard/WildcardPushdownSystem.java
+++ b/WPDS/src/main/java/wpds/wildcard/WildcardPushdownSystem.java
@@ -11,6 +11,8 @@
*/
package wpds.wildcard;
+import de.fraunhofer.iem.Location;
+import de.fraunhofer.iem.wildcard.Wildcard;
import java.util.HashSet;
import java.util.Set;
import wpds.impl.NormalRule;
@@ -22,7 +24,6 @@
import wpds.impl.UPopRule;
import wpds.impl.UPushRule;
import wpds.impl.Weight.NoWeight;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public abstract class WildcardPushdownSystem
diff --git a/WPDS/src/test/java/tests/ForwardDFSVisitorTest.java b/WPDS/src/test/java/tests/ForwardDFSVisitorTest.java
index a8d9dafe..9d9f16fb 100644
--- a/WPDS/src/test/java/tests/ForwardDFSVisitorTest.java
+++ b/WPDS/src/test/java/tests/ForwardDFSVisitorTest.java
@@ -97,7 +97,7 @@ public void reachable(Transition t) {
fa.addTransition(t(2, "n1", 4));
- Assert.assertTrue(fa.getTransitions().size() == reachables.size());
+ Assert.assertEquals(fa.getTransitions().size(), reachables.size());
Assert.assertTrue(reachableMinusTrans().isEmpty());
fa.addTransition(t(3, "n1", 8));
diff --git a/WPDS/src/test/java/tests/MinSemiring.java b/WPDS/src/test/java/tests/MinSemiring.java
index 455c9d0a..cbb96321 100644
--- a/WPDS/src/test/java/tests/MinSemiring.java
+++ b/WPDS/src/test/java/tests/MinSemiring.java
@@ -11,8 +11,8 @@
*/
package tests;
+import de.fraunhofer.iem.Location;
import wpds.impl.Weight;
-import wpds.interfaces.Location;
public class MinSemiring extends Weight {
int i;
@@ -86,7 +86,6 @@ public boolean equals(Object obj) {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
MinSemiring other = (MinSemiring) obj;
- if (i != other.i) return false;
- return true;
+ return i == other.i;
}
}
diff --git a/WPDS/src/test/java/tests/NumWeight.java b/WPDS/src/test/java/tests/NumWeight.java
index 1a785648..b4d26ba4 100644
--- a/WPDS/src/test/java/tests/NumWeight.java
+++ b/WPDS/src/test/java/tests/NumWeight.java
@@ -11,8 +11,8 @@
*/
package tests;
+import de.fraunhofer.iem.Location;
import wpds.impl.Weight;
-import wpds.interfaces.Location;
public class NumWeight extends Weight {
@@ -99,7 +99,6 @@ public boolean equals(Object obj) {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
NumWeight other = (NumWeight) obj;
- if (i != other.i) return false;
- return true;
+ return i == other.i;
}
}
diff --git a/WPDS/src/test/java/tests/PrefixImportTests.java b/WPDS/src/test/java/tests/PrefixImportTests.java
index 93ee0ea2..6629df97 100644
--- a/WPDS/src/test/java/tests/PrefixImportTests.java
+++ b/WPDS/src/test/java/tests/PrefixImportTests.java
@@ -2,11 +2,11 @@
import static org.junit.Assert.assertTrue;
+import de.fraunhofer.iem.Location;
import org.junit.Test;
import wpds.impl.PAutomaton;
import wpds.impl.PrefixImport;
import wpds.impl.Transition;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public class PrefixImportTests {
@@ -92,7 +92,7 @@ private Transition t(String start, String label, String
}
class StringState implements State {
- private String rep;
+ private final String rep;
public StringState(String string) {
rep = string;
@@ -119,9 +119,8 @@ public boolean equals(Object obj) {
StringState other = (StringState) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (rep == null) {
- if (other.rep != null) return false;
- } else if (!rep.equals(other.rep)) return false;
- return true;
+ return other.rep == null;
+ } else return rep.equals(other.rep);
}
@Override
@@ -153,12 +152,11 @@ public boolean equals(Object obj) {
StringLoc other = (StringLoc) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (rep == null) {
- if (other.rep != null) return false;
- } else if (!rep.equals(other.rep)) return false;
- return true;
+ return other.rep == null;
+ } else return rep.equals(other.rep);
}
- private String rep;
+ private final String rep;
public StringLoc(String string) {
rep = string;
diff --git a/WPDS/src/test/java/tests/TestHelper.java b/WPDS/src/test/java/tests/TestHelper.java
index 6142922d..807aca7e 100644
--- a/WPDS/src/test/java/tests/TestHelper.java
+++ b/WPDS/src/test/java/tests/TestHelper.java
@@ -11,6 +11,7 @@
*/
package tests;
+import de.fraunhofer.iem.Location;
import wpds.impl.NormalRule;
import wpds.impl.PAutomaton;
import wpds.impl.PopRule;
@@ -20,7 +21,6 @@
import wpds.impl.UPopRule;
import wpds.impl.UPushRule;
import wpds.impl.WeightedPAutomaton;
-import wpds.interfaces.Location;
import wpds.interfaces.State;
public class TestHelper {
@@ -175,9 +175,8 @@ public boolean equals(Object obj) {
Abstraction other = (Abstraction) obj;
if (a != other.a) return false;
if (s == null) {
- if (other.s != null) return false;
- } else if (!s.equals(other.s)) return false;
- return true;
+ return other.s == null;
+ } else return s.equals(other.s);
}
}
@@ -203,9 +202,8 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) return false;
StackSymbol other = (StackSymbol) obj;
if (s == null) {
- if (other.s != null) return false;
- } else if (!s.equals(other.s)) return false;
- return true;
+ return other.s == null;
+ } else return s.equals(other.s);
}
@Override
diff --git a/boomerangPDS/pom.xml b/boomerangPDS/pom.xml
index 3b6b8f9b..06bea4e7 100644
--- a/boomerangPDS/pom.xml
+++ b/boomerangPDS/pom.xml
@@ -1,4 +1,5 @@
-
+
de.fraunhofer.iem
SPDS
@@ -7,12 +8,13 @@
4.0.0
boomerangPDS
+
org.apache.maven.plugins
maven-surefire-plugin
- 3.5.2
+ ${maven-surefire-plugin.version}
-Xmx8G -Xss128m
@@ -27,7 +29,10 @@
de.fraunhofer.iem
boomerangScope
- 3.2.3
+
+
+ de.fraunhofer.iem
+ synchronizedPDS
com.google.guava
@@ -41,14 +46,14 @@
com.googlecode.json-simple
json-simple
1.1.1
-
-
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-simple
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-simple
@@ -63,7 +68,12 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.5.2
+ ${maven-surefire-plugin.version}
+
+
+ integration-test
+
+
**/*LongTest.java
diff --git a/boomerangPDS/src/main/java/boomerang/Boomerang.java b/boomerangPDS/src/main/java/boomerang/Boomerang.java
index e8cea8cd..f830bc5a 100644
--- a/boomerangPDS/src/main/java/boomerang/Boomerang.java
+++ b/boomerangPDS/src/main/java/boomerang/Boomerang.java
@@ -11,11 +11,8 @@
*/
package boomerang;
-import boomerang.scene.CallGraph;
+import boomerang.scene.*;
import boomerang.scene.ControlFlowGraph.Edge;
-import boomerang.scene.DataFlowScope;
-import boomerang.scene.Field;
-import boomerang.scene.Val;
import sync.pds.solver.OneWeightFunctions;
import sync.pds.solver.WeightFunctions;
import wpds.impl.Weight;
@@ -25,12 +22,13 @@ public class Boomerang extends WeightedBoomerang {
private OneWeightFunctions fieldWeights;
private OneWeightFunctions callWeights;
- public Boomerang(CallGraph callGraph, DataFlowScope scope) {
- super(callGraph, scope);
+ public Boomerang(CallGraph callGraph, DataFlowScope scope, FrameworkScope scopeFactory) {
+ super(callGraph, scope, scopeFactory);
}
- public Boomerang(CallGraph callGraph, DataFlowScope scope, BoomerangOptions opt) {
- super(callGraph, scope, opt);
+ public Boomerang(
+ CallGraph callGraph, DataFlowScope scope, BoomerangOptions opt, FrameworkScope scopeFactory) {
+ super(callGraph, scope, opt, scopeFactory);
}
@Override
diff --git a/boomerangPDS/src/main/java/boomerang/BoomerangOptions.java b/boomerangPDS/src/main/java/boomerang/BoomerangOptions.java
index 7df3c608..38f54030 100644
--- a/boomerangPDS/src/main/java/boomerang/BoomerangOptions.java
+++ b/boomerangPDS/src/main/java/boomerang/BoomerangOptions.java
@@ -19,9 +19,9 @@
import boomerang.scene.Method;
import boomerang.scene.Statement;
import boomerang.scene.Val;
-import boomerang.scene.sparse.SparseCFGCache;
import boomerang.stats.IBoomerangStats;
import java.util.Optional;
+import sparse.SparsificationStrategy;
public interface BoomerangOptions {
@@ -105,7 +105,7 @@ enum ArrayStrategy {
boolean allowMultipleQueries();
- SparseCFGCache.SparsificationStrategy getSparsificationStrategy();
+ SparsificationStrategy getSparsificationStrategy();
boolean handleSpecialInvokeAsNormalPropagation();
diff --git a/boomerangPDS/src/main/java/boomerang/BoomerangTimeoutException.java b/boomerangPDS/src/main/java/boomerang/BoomerangTimeoutException.java
index bd151398..94e201d8 100644
--- a/boomerangPDS/src/main/java/boomerang/BoomerangTimeoutException.java
+++ b/boomerangPDS/src/main/java/boomerang/BoomerangTimeoutException.java
@@ -15,8 +15,8 @@
public class BoomerangTimeoutException extends RuntimeException {
- private IBoomerangStats stats;
- private long elapsed;
+ private final IBoomerangStats stats;
+ private final long elapsed;
BoomerangTimeoutException(long elapsed, IBoomerangStats stats) {
this.elapsed = elapsed;
diff --git a/boomerangPDS/src/main/java/boomerang/Context.java b/boomerangPDS/src/main/java/boomerang/Context.java
index bcd3d663..a8832fb9 100644
--- a/boomerangPDS/src/main/java/boomerang/Context.java
+++ b/boomerangPDS/src/main/java/boomerang/Context.java
@@ -9,9 +9,9 @@
* @author "Johannes Spaeth"
*/
public interface Context {
- public Statement getStmt();
+ Statement getStmt();
- public int hashCode();
+ int hashCode();
- public boolean equals(Object obj);
+ boolean equals(Object obj);
}
diff --git a/boomerangPDS/src/main/java/boomerang/DefaultBoomerangOptions.java b/boomerangPDS/src/main/java/boomerang/DefaultBoomerangOptions.java
index 527108e6..a4a73c22 100644
--- a/boomerangPDS/src/main/java/boomerang/DefaultBoomerangOptions.java
+++ b/boomerangPDS/src/main/java/boomerang/DefaultBoomerangOptions.java
@@ -19,7 +19,6 @@
import boomerang.scene.Method;
import boomerang.scene.Statement;
import boomerang.scene.Val;
-import boomerang.scene.sparse.SparseCFGCache;
import boomerang.stats.IBoomerangStats;
import boomerang.stats.SimpleBoomerangStats;
import com.google.common.base.Joiner;
@@ -27,6 +26,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import sparse.SparsificationStrategy;
public class DefaultBoomerangOptions implements BoomerangOptions {
@@ -218,8 +218,8 @@ public boolean allowMultipleQueries() {
}
@Override
- public SparseCFGCache.SparsificationStrategy getSparsificationStrategy() {
- return SparseCFGCache.SparsificationStrategy.NONE;
+ public SparsificationStrategy getSparsificationStrategy() {
+ return new SparsificationStrategy.NoSparsificationStrategy();
}
@Override
@@ -233,7 +233,7 @@ public boolean ignoreSparsificationAfterQuery() {
}
public void checkValid() {
- if (trackPathConditions() == false && prunePathConditions()) {
+ if (!trackPathConditions() && prunePathConditions()) {
throw new RuntimeException(
"InvalidCombinations of Options, Path Conditions must be ables when pruning path conditions");
}
diff --git a/boomerangPDS/src/main/java/boomerang/IContextRequester.java b/boomerangPDS/src/main/java/boomerang/IContextRequester.java
index f58dbfd3..a1e97c56 100644
--- a/boomerangPDS/src/main/java/boomerang/IContextRequester.java
+++ b/boomerangPDS/src/main/java/boomerang/IContextRequester.java
@@ -4,7 +4,7 @@
import java.util.Collection;
public interface IContextRequester {
- public Collection getCallSiteOf(Context child);
+ Collection getCallSiteOf(Context child);
- public Context initialContext(Statement stmt);
+ Context initialContext(Statement stmt);
}
diff --git a/boomerangPDS/src/main/java/boomerang/Query.java b/boomerangPDS/src/main/java/boomerang/Query.java
index b4794dd1..2acfdc1e 100644
--- a/boomerangPDS/src/main/java/boomerang/Query.java
+++ b/boomerangPDS/src/main/java/boomerang/Query.java
@@ -64,9 +64,8 @@ public boolean equals(Object obj) {
if (other.cfgEdge != null) return false;
} else if (!cfgEdge.equals(other.cfgEdge)) return false;
if (variable == null) {
- if (other.variable != null) return false;
- } else if (!variable.equals(other.variable)) return false;
- return true;
+ return other.variable == null;
+ } else return variable.equals(other.variable);
}
public Type getType() {
diff --git a/boomerangPDS/src/main/java/boomerang/QueryGraph.java b/boomerangPDS/src/main/java/boomerang/QueryGraph.java
index 6d4061b9..5c85e86a 100644
--- a/boomerangPDS/src/main/java/boomerang/QueryGraph.java
+++ b/boomerangPDS/src/main/java/boomerang/QueryGraph.java
@@ -34,12 +34,12 @@
public class QueryGraph {
private static final Logger LOGGER = LoggerFactory.getLogger(QueryGraph.class);
private final ObservableICFG icfg;
- private Multimap sourceToQueryEdgeLookUp = HashMultimap.create();
- private Multimap targetToQueryEdgeLookUp = HashMultimap.create();
- private Set roots = Sets.newHashSet();
- private DefaultValueMap> forwardSolvers;
- private Multimap edgeAddListener = HashMultimap.create();
- private DefaultValueMap> backwardSolver;
+ private final Multimap sourceToQueryEdgeLookUp = HashMultimap.create();
+ private final Multimap targetToQueryEdgeLookUp = HashMultimap.create();
+ private final Set roots = Sets.newHashSet();
+ private final DefaultValueMap> forwardSolvers;
+ private final Multimap edgeAddListener = HashMultimap.create();
+ private final DefaultValueMap> backwardSolver;
public QueryGraph(WeightedBoomerang weightedBoomerang) {
this.forwardSolvers = weightedBoomerang.getSolvers();
@@ -83,9 +83,9 @@ public Set getNodes() {
private class SourceListener extends WPAStateListener, W> {
- private Query child;
- private Query parent;
- private Method callee;
+ private final Query child;
+ private final Query parent;
+ private final Method callee;
public SourceListener(INode state, Query parent, Query child, Method callee) {
super(state);
@@ -151,9 +151,8 @@ public boolean equals(Object obj) {
if (other.child != null) return false;
} else if (!child.equals(other.child)) return false;
if (parent == null) {
- if (other.parent != null) return false;
- } else if (!parent.equals(other.parent)) return false;
- return true;
+ return other.parent == null;
+ } else return parent.equals(other.parent);
}
private QueryGraph getEnclosingInstance() {
@@ -194,8 +193,8 @@ private interface AddTargetEdgeListener {
private class UnbalancedContextListener implements AddTargetEdgeListener {
private final Transition> transition;
- private Query parent;
- private Query child;
+ private final Query parent;
+ private final Query child;
public UnbalancedContextListener(Query child, Query parent, Transition> t) {
this.child = child;
@@ -262,9 +261,8 @@ public boolean equals(Object obj) {
if (other.parent != null) return false;
} else if (!parent.equals(other.parent)) return false;
if (parent == null) {
- if (other.transition != null) return false;
- } else if (!transition.equals(other.transition)) return false;
- return true;
+ return other.transition == null;
+ } else return transition.equals(other.transition);
}
private QueryGraph getEnclosingInstance() {
@@ -308,7 +306,7 @@ private String escapeQuotes(String string) {
private static class QueryEdge {
private final Query source;
private final Query target;
- private Node node;
+ private final Node node;
public QueryEdge(Query source, Node node, Query target) {
this.source = source;
@@ -351,9 +349,8 @@ public boolean equals(Object obj) {
if (other.target != null) return false;
} else if (!target.equals(other.target)) return false;
if (node == null) {
- if (other.node != null) return false;
- } else if (!node.equals(other.node)) return false;
- return true;
+ return other.node == null;
+ } else return node.equals(other.node);
}
}
diff --git a/boomerangPDS/src/main/java/boomerang/WeightedBoomerang.java b/boomerangPDS/src/main/java/boomerang/WeightedBoomerang.java
index d79b25b2..0f8ca47e 100644
--- a/boomerangPDS/src/main/java/boomerang/WeightedBoomerang.java
+++ b/boomerangPDS/src/main/java/boomerang/WeightedBoomerang.java
@@ -28,21 +28,9 @@
import boomerang.poi.PointOfIndirection;
import boomerang.results.BackwardBoomerangResults;
import boomerang.results.ForwardBoomerangResults;
-import boomerang.scene.AllocVal;
-import boomerang.scene.CallGraph;
-import boomerang.scene.ControlFlowGraph;
+import boomerang.scene.*;
import boomerang.scene.ControlFlowGraph.Edge;
-import boomerang.scene.DataFlowScope;
-import boomerang.scene.Field;
import boomerang.scene.Field.ArrayField;
-import boomerang.scene.Method;
-import boomerang.scene.Pair;
-import boomerang.scene.Statement;
-import boomerang.scene.StaticFieldVal;
-import boomerang.scene.Val;
-import boomerang.scene.jimple.JimpleField;
-import boomerang.scene.jimple.JimpleMethod;
-import boomerang.scene.jimple.JimpleStaticFieldVal;
import boomerang.solver.AbstractBoomerangSolver;
import boomerang.solver.BackwardBoomerangSolver;
import boomerang.solver.ControlFlowEdgeBasedFieldTransitionListener;
@@ -64,9 +52,9 @@
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import soot.SootMethod;
import sync.pds.solver.SyncPDSSolver.PDSSystem;
import sync.pds.solver.WeightFunctions;
import sync.pds.solver.nodes.GeneratedState;
@@ -85,17 +73,19 @@
import wpds.interfaces.WPAStateListener;
public abstract class WeightedBoomerang {
+ protected final FrameworkScope scopeFactory;
protected ObservableICFG icfg;
protected ObservableControlFlowGraph cfg;
private static final Logger LOGGER = LoggerFactory.getLogger(WeightedBoomerang.class);
- private Map>, Field>, INode>> genField =
+ private final Map>, Field>, INode>> genField =
new HashMap<>();
private long lastTick;
- private IBoomerangStats stats;
- private Set visitedMethods = Sets.newHashSet();
- private Set> solverCreationListeners = Sets.newHashSet();
- private Multimap> poiListeners = HashMultimap.create();
- private Multimap>> activatedPoi = HashMultimap.create();
+ private final IBoomerangStats stats;
+ private final Set visitedMethods = Sets.newHashSet();
+ private final Set> solverCreationListeners = Sets.newHashSet();
+ private final Multimap> poiListeners =
+ HashMultimap.create();
+ private final Multimap>> activatedPoi = HashMultimap.create();
private final DefaultValueMap> queryToSolvers =
new DefaultValueMap>() {
@Override
@@ -195,32 +185,28 @@ private void handleStaticInitializer(
&& node.fact().isStatic()
&& isFirstStatementOfEntryPoint(node.stmt().getStart())) {
Val fact = node.fact();
- if (fact instanceof JimpleStaticFieldVal) {
- JimpleStaticFieldVal val = ((JimpleStaticFieldVal) fact);
- for (SootMethod m :
- ((JimpleField) val.field()).getSootField().getDeclaringClass().getMethods()) {
- if (!m.hasActiveBody()) {
- continue;
- }
- JimpleMethod jimpleMethod = JimpleMethod.of(m);
- if (m.isStaticInitializer()) {
- for (Statement ep : icfg().getEndPointsOf(JimpleMethod.of(m))) {
- StaticFieldVal newVal =
- new JimpleStaticFieldVal(((JimpleField) val.field()), jimpleMethod);
- cfg.addPredsOfListener(
- new PredecessorListener(ep) {
- @Override
- public void getPredecessor(Statement pred) {
- backwardSolver.addNormalCallFlow(
- node, new Node<>(new Edge(pred, ep), newVal));
- backwardSolver.addNormalFieldFlow(
- node, new Node<>(new Edge(pred, ep), newVal));
- }
- });
+ Stream methodStream = scopeFactory.handleStaticFieldInitializers(fact);
+
+ methodStream.forEach(
+ m -> {
+ // TODO: [ms] check if still needed: I removed the "interner" JimpleMethod.of(m)
+ if (m.isStaticInitializer()) {
+ for (Statement ep : icfg.getEndPointsOf(m)) {
+ StaticFieldVal newVal =
+ scopeFactory.newStaticFieldVal(((StaticFieldVal) fact).field(), m);
+ cfg.addPredsOfListener(
+ new PredecessorListener(ep) {
+ @Override
+ public void getPredecessor(Statement pred) {
+ backwardSolver.addNormalCallFlow(
+ node, new Node<>(new ControlFlowGraph.Edge(pred, ep), newVal));
+ backwardSolver.addNormalFieldFlow(
+ node, new Node<>(new ControlFlowGraph.Edge(pred, ep), newVal));
+ }
+ });
+ }
}
- }
- }
- }
+ });
}
}
@@ -388,15 +374,15 @@ public void checkTimeout() {
}
private ObservableICFG bwicfg;
- private NestedWeightedPAutomatons, W> backwardCallSummaries =
+ private final NestedWeightedPAutomatons, W> backwardCallSummaries =
new SummaryNestedWeightedPAutomatons<>();
- private NestedWeightedPAutomatons>, W> backwardFieldSummaries =
+ private final NestedWeightedPAutomatons>, W> backwardFieldSummaries =
new SummaryNestedWeightedPAutomatons<>();
- private NestedWeightedPAutomatons, W> forwardCallSummaries =
+ private final NestedWeightedPAutomatons, W> forwardCallSummaries =
new SummaryNestedWeightedPAutomatons<>();
- private NestedWeightedPAutomatons>, W> forwardFieldSummaries =
+ private final NestedWeightedPAutomatons>, W> forwardFieldSummaries =
new SummaryNestedWeightedPAutomatons<>();
- private DefaultValueMap fieldWrites =
+ private final DefaultValueMap fieldWrites =
new DefaultValueMap() {
@Override
protected FieldWritePOI createItem(FieldWritePOI key) {
@@ -405,12 +391,14 @@ protected FieldWritePOI createItem(FieldWritePOI key) {
}
};
protected final BoomerangOptions options;
- private Stopwatch analysisWatch = Stopwatch.createUnstarted();
+ private final Stopwatch analysisWatch = Stopwatch.createUnstarted();
private final DataFlowScope dataFlowscope;
- private CallGraph callGraph;
+ private final CallGraph callGraph;
private INode rootQuery;
- public WeightedBoomerang(CallGraph cg, DataFlowScope scope, BoomerangOptions options) {
+ public WeightedBoomerang(
+ CallGraph cg, DataFlowScope scope, BoomerangOptions options, FrameworkScope scopeFactory) {
+ this.scopeFactory = scopeFactory;
this.options = options;
this.options.checkValid();
this.stats = options.statsFactory();
@@ -432,8 +420,8 @@ public WeightedBoomerang(CallGraph cg, DataFlowScope scope, BoomerangOptions opt
this.queryGraph = new QueryGraph<>(this);
}
- public WeightedBoomerang(CallGraph cg, DataFlowScope scope) {
- this(cg, scope, new DefaultBoomerangOptions());
+ public WeightedBoomerang(CallGraph cg, DataFlowScope scope, FrameworkScope scopeFactory) {
+ this(cg, scope, new DefaultBoomerangOptions(), scopeFactory);
}
protected void addVisitedMethod(Method method) {
@@ -658,8 +646,8 @@ public QueryGraph getQueryGraph() {
private final class EmptyFieldListener
extends WPAStateListener>, W> {
- private BackwardQuery key;
- private Node node;
+ private final BackwardQuery key;
+ private final Node node;
public EmptyFieldListener(BackwardQuery key, Node node) {
super(new SingleNode<>(node));
@@ -681,8 +669,7 @@ public boolean equals(Object obj) {
if (!super.equals(obj)) return false;
if (getClass() != obj.getClass()) return false;
EmptyFieldListener other = (EmptyFieldListener) obj;
- if (!getEnclosingInstance().equals(other.getEnclosingInstance())) return false;
- return true;
+ return getEnclosingInstance().equals(other.getEnclosingInstance());
}
@Override
@@ -725,9 +712,9 @@ private final class ArrayAllocationListener
extends WPAStateListener>, W> {
private final int arrayAccessIndex;
- private AllocVal val;
- private BackwardQuery key;
- private Node node;
+ private final AllocVal val;
+ private final BackwardQuery key;
+ private final Node node;
public ArrayAllocationListener(
int arrayAccessIndex,
@@ -785,8 +772,7 @@ public boolean equals(Object obj) {
if (!super.equals(obj)) return false;
if (getClass() != obj.getClass()) return false;
ArrayAllocationListener other = (ArrayAllocationListener) obj;
- if (!getEnclosingInstance().equals(other.getEnclosingInstance())) return false;
- return true;
+ return getEnclosingInstance().equals(other.getEnclosingInstance());
}
}
@@ -831,9 +817,8 @@ public boolean equals(Object obj) {
ForwardHandleFieldWrite other = (ForwardHandleFieldWrite) obj;
if (!getOuterType().equals(other.getOuterType())) return false;
if (sourceQuery == null) {
- if (other.sourceQuery != null) return false;
- } else if (!sourceQuery.equals(other.sourceQuery)) return false;
- return true;
+ return other.sourceQuery == null;
+ } else return sourceQuery.equals(other.sourceQuery);
}
private WeightedBoomerang getOuterType() {
@@ -893,9 +878,8 @@ public boolean equals(Object obj) {
if (other.fieldWritePoi != null) return false;
} else if (!fieldWritePoi.equals(other.fieldWritePoi)) return false;
if (sourceQuery == null) {
- if (other.sourceQuery != null) return false;
- } else if (!sourceQuery.equals(other.sourceQuery)) return false;
- return true;
+ return other.sourceQuery == null;
+ } else return sourceQuery.equals(other.sourceQuery);
}
private WeightedBoomerang getOuterType() {
@@ -952,6 +936,7 @@ public ForwardBoomerangResults solve(ForwardQuery query) {
analysisWatch.stop();
}
return new ForwardBoomerangResults(
+ scopeFactory,
query,
icfg(),
cfg(),
@@ -1065,6 +1050,7 @@ public ForwardBoomerangResults solveUnderScope(
analysisWatch.stop();
}
return new ForwardBoomerangResults(
+ scopeFactory,
query,
icfg(),
cfg(),
@@ -1265,8 +1251,8 @@ public void registerActivationListener(SolverPair solverPair, ExecuteImportField
private class SolverPair {
- private AbstractBoomerangSolver flowSolver;
- private AbstractBoomerangSolver baseSolver;
+ private final AbstractBoomerangSolver flowSolver;
+ private final AbstractBoomerangSolver baseSolver;
public SolverPair(
AbstractBoomerangSolver flowSolver, AbstractBoomerangSolver baseSolver) {
@@ -1295,9 +1281,8 @@ public boolean equals(Object obj) {
if (other.baseSolver != null) return false;
} else if (!baseSolver.equals(other.baseSolver)) return false;
if (flowSolver == null) {
- if (other.flowSolver != null) return false;
- } else if (!flowSolver.equals(other.flowSolver)) return false;
- return true;
+ return other.flowSolver == null;
+ } else return flowSolver.equals(other.flowSolver);
}
private WeightedBoomerang getOuterType() {
diff --git a/boomerangPDS/src/main/java/boomerang/WholeProgramBoomerang.java b/boomerangPDS/src/main/java/boomerang/WholeProgramBoomerang.java
index 5cbc4990..2c1ab779 100644
--- a/boomerangPDS/src/main/java/boomerang/WholeProgramBoomerang.java
+++ b/boomerangPDS/src/main/java/boomerang/WholeProgramBoomerang.java
@@ -11,11 +11,8 @@
*/
package boomerang;
-import boomerang.scene.AnalysisScope;
-import boomerang.scene.CallGraph;
+import boomerang.scene.*;
import boomerang.scene.ControlFlowGraph.Edge;
-import boomerang.scene.DataFlowScope;
-import boomerang.scene.Statement;
import java.util.Collection;
import java.util.Collections;
import wpds.impl.Weight;
@@ -23,15 +20,16 @@
public abstract class WholeProgramBoomerang extends WeightedBoomerang {
private int reachableMethodCount;
private int allocationSites;
- private CallGraph callGraph;
+ private final CallGraph callGraph;
- public WholeProgramBoomerang(CallGraph cg, DataFlowScope scope, BoomerangOptions opts) {
- super(cg, scope, opts);
+ public WholeProgramBoomerang(
+ CallGraph cg, DataFlowScope scope, BoomerangOptions opts, FrameworkScope scopeFactory) {
+ super(cg, scope, opts, scopeFactory);
this.callGraph = cg;
}
- public WholeProgramBoomerang(CallGraph cg, DataFlowScope scope) {
- this(cg, scope, new DefaultBoomerangOptions());
+ public WholeProgramBoomerang(CallGraph cg, DataFlowScope scope, FrameworkScope scopeFactory) {
+ this(cg, scope, new DefaultBoomerangOptions(), scopeFactory);
}
public void wholeProgramAnalysis() {
diff --git a/boomerangPDS/src/main/java/boomerang/callgraph/BoomerangResolver.java b/boomerangPDS/src/main/java/boomerang/callgraph/BoomerangResolver.java
index 7d1b9374..cc28d6da 100644
--- a/boomerangPDS/src/main/java/boomerang/callgraph/BoomerangResolver.java
+++ b/boomerangPDS/src/main/java/boomerang/callgraph/BoomerangResolver.java
@@ -7,16 +7,8 @@
import boomerang.SolverCreationListener;
import boomerang.WeightedBoomerang;
import boomerang.results.ExtractAllocationSiteStateListener;
-import boomerang.scene.CallGraph;
+import boomerang.scene.*;
import boomerang.scene.ControlFlowGraph.Edge;
-import boomerang.scene.DataFlowScope;
-import boomerang.scene.DeclaredMethod;
-import boomerang.scene.InvokeExpr;
-import boomerang.scene.Method;
-import boomerang.scene.Statement;
-import boomerang.scene.Type;
-import boomerang.scene.Val;
-import boomerang.scene.WrappedClass;
import boomerang.solver.AbstractBoomerangSolver;
import boomerang.solver.ForwardBoomerangSolver;
import com.google.common.collect.HashMultimap;
@@ -47,16 +39,18 @@ public enum NoCalleeFoundFallbackOptions {
private static final String THREAD_START_SIGNATURE = "";
private static final String THREAD_RUN_SUB_SIGNATURE = "void run()";
- private static NoCalleeFoundFallbackOptions FALLBACK_OPTION = NoCalleeFoundFallbackOptions.BYPASS;
- private static Multimap didNotFindMethodLog = HashMultimap.create();
+ private static final NoCalleeFoundFallbackOptions FALLBACK_OPTION =
+ NoCalleeFoundFallbackOptions.BYPASS;
+ private static final Multimap didNotFindMethodLog =
+ HashMultimap.create();
- private CallGraph precomputedCallGraph;
- private WeightedBoomerang extends Weight> solver;
- private Set queriedInvokeExprAndAllocationSitesFound = Sets.newHashSet();
- private Set queriedInvokeExpr = Sets.newHashSet();
+ private final CallGraph precomputedCallGraph;
+ private final WeightedBoomerang extends Weight> solver;
+ private final Set queriedInvokeExprAndAllocationSitesFound = Sets.newHashSet();
+ private final Set queriedInvokeExpr = Sets.newHashSet();
- public BoomerangResolver(CallGraph cg, DataFlowScope scope) {
- this.solver = new Boomerang(cg, scope);
+ public BoomerangResolver(CallGraph cg, DataFlowScope scope, FrameworkScope scopeFactory) {
+ this.solver = new Boomerang(cg, scope, scopeFactory);
this.precomputedCallGraph = cg;
}
@@ -268,9 +262,8 @@ public boolean equals(Object obj) {
if (other.query != null) return false;
} else if (!query.equals(other.query)) return false;
if (invokeExpr == null) {
- if (other.invokeExpr != null) return false;
- } else if (!invokeExpr.equals(other.invokeExpr)) return false;
- return true;
+ return other.invokeExpr == null;
+ } else return invokeExpr.equals(other.invokeExpr);
}
private BoomerangResolver getOuterType() {
diff --git a/boomerangPDS/src/main/java/boomerang/callgraph/ObservableDynamicICFG.java b/boomerangPDS/src/main/java/boomerang/callgraph/ObservableDynamicICFG.java
index e401ff82..f7c70ea0 100644
--- a/boomerangPDS/src/main/java/boomerang/callgraph/ObservableDynamicICFG.java
+++ b/boomerangPDS/src/main/java/boomerang/callgraph/ObservableDynamicICFG.java
@@ -30,7 +30,7 @@ public class ObservableDynamicICFG implements ObservableICFG
private int numberOfEdgesTakenFromPrecomputedCallGraph = 0;
- private CallGraphOptions options = new CallGraphOptions();
+ private final CallGraphOptions options = new CallGraphOptions();
private CallGraph demandDrivenCallGraph = new CallGraph();
private final Multimap> calleeListeners =
diff --git a/boomerangPDS/src/main/java/boomerang/callgraph/ObservableStaticICFG.java b/boomerangPDS/src/main/java/boomerang/callgraph/ObservableStaticICFG.java
index b7e6ba8e..7e9b6f48 100644
--- a/boomerangPDS/src/main/java/boomerang/callgraph/ObservableStaticICFG.java
+++ b/boomerangPDS/src/main/java/boomerang/callgraph/ObservableStaticICFG.java
@@ -17,7 +17,7 @@
*/
public class ObservableStaticICFG implements ObservableICFG {
/** Wrapped static ICFG. If available, this is used to handle all queries. */
- private CallGraph precomputedGraph;
+ private final CallGraph precomputedGraph;
private static final Logger LOGGER = LoggerFactory.getLogger(ObservableStaticICFG.class);
private static final int IMPRECISE_CALL_GRAPH_WARN_THRESHOLD = 30000;
diff --git a/boomerangPDS/src/main/java/boomerang/controlflowgraph/ForwardSolverSuccessorListener.java b/boomerangPDS/src/main/java/boomerang/controlflowgraph/ForwardSolverSuccessorListener.java
index fe36493d..1707e0ec 100644
--- a/boomerangPDS/src/main/java/boomerang/controlflowgraph/ForwardSolverSuccessorListener.java
+++ b/boomerangPDS/src/main/java/boomerang/controlflowgraph/ForwardSolverSuccessorListener.java
@@ -5,19 +5,13 @@
import boomerang.scene.Method;
import boomerang.scene.Statement;
import boomerang.scene.Val;
-import boomerang.scene.jimple.JimpleMethod;
-import boomerang.scene.jimple.JimpleStatement;
-import boomerang.scene.sparse.SparseAliasingCFG;
-import boomerang.scene.sparse.SparseCFGCache;
import boomerang.solver.ForwardBoomerangSolver;
import java.util.Collection;
-import soot.SootMethod;
-import soot.jimple.Stmt;
import sync.pds.solver.nodes.Node;
import wpds.interfaces.State;
/**
- * To replace the anonymous impl in ForwardSolver, so that we can access the Edge fiel of the outer
+ * To replace the anonymous impl in ForwardSolver, so that we can access the Edge field of the outer
* method
*/
public class ForwardSolverSuccessorListener extends SuccessorListener {
@@ -119,6 +113,7 @@ public void getSuccessor(Statement succ) {
}
}
+ /* [ms] method was unused?
private SparseAliasingCFG getSparseCFG(Method method, Statement stmt, Val currentVal) {
SootMethod sootMethod = ((JimpleMethod) method).getDelegate();
Stmt sootStmt = ((JimpleStatement) stmt).getDelegate();
@@ -128,4 +123,5 @@ private SparseAliasingCFG getSparseCFG(Method method, Statement stmt, Val curren
sparseCFGCache.getSparseCFGForForwardPropagation(sootMethod, sootStmt, currentVal);
return sparseCFG;
}
+ */
}
diff --git a/boomerangPDS/src/main/java/boomerang/controlflowgraph/StaticCFG.java b/boomerangPDS/src/main/java/boomerang/controlflowgraph/StaticCFG.java
index f8e0675f..63349258 100644
--- a/boomerangPDS/src/main/java/boomerang/controlflowgraph/StaticCFG.java
+++ b/boomerangPDS/src/main/java/boomerang/controlflowgraph/StaticCFG.java
@@ -4,22 +4,13 @@
import boomerang.scene.Method;
import boomerang.scene.Statement;
import boomerang.scene.Val;
-import boomerang.scene.jimple.JimpleMethod;
-import boomerang.scene.jimple.JimpleStatement;
-import boomerang.scene.sparse.SootAdapter;
-import boomerang.scene.sparse.SparseAliasingCFG;
-import boomerang.scene.sparse.SparseCFGCache;
-import boomerang.scene.sparse.eval.PropagationCounter;
-import java.util.*;
-import soot.SootMethod;
-import soot.Unit;
-import soot.jimple.Stmt;
+import sparse.SparsificationStrategy;
public class StaticCFG implements ObservableControlFlowGraph {
- private SparseCFGCache.SparsificationStrategy sparsificationStrategy;
+ private final SparsificationStrategy sparsificationStrategy;
- private BoomerangOptions options;
+ private final BoomerangOptions options;
private Val currentVal;
@@ -43,7 +34,9 @@ public void addPredsOfListener(PredecessorListener l) {
public void addSuccsOfListener(SuccessorListener l) {
Method method = l.getCurr().getMethod();
Statement curr = l.getCurr();
- if (sparsificationStrategy != SparseCFGCache.SparsificationStrategy.NONE) {
+ /*
+ TODO: [ms] reenable sparsification
+ if (sparsificationStrategy != SparsificationStrategy.NONE) {
SparseAliasingCFG sparseCFG = getSparseCFG(method, curr, currentVal);
if (sparseCFG != null) {
propagateSparse(l, method, curr, sparseCFG);
@@ -52,27 +45,33 @@ public void addSuccsOfListener(SuccessorListener l) {
} else {
propagateDefault(l); // back up when not found
}
- } else {
+ } else */
+ {
propagateDefault(l);
}
}
+ /*
+ TODO: [ms] reenable sparsification
private void propagateSparse(
SuccessorListener l, Method method, Statement curr, SparseAliasingCFG sparseCFG) {
Set successors = sparseCFG.getGraph().successors(SootAdapter.asStmt(curr));
for (Unit succ : successors) {
- PropagationCounter.getInstance(sparsificationStrategy).countForward();
+ sparsificationStrategy.getCounter().countForward();
l.getSuccessor(SootAdapter.asStatement(succ, method));
}
}
+ */
private void propagateDefault(SuccessorListener l) {
for (Statement s : l.getCurr().getMethod().getControlFlowGraph().getSuccsOf(l.getCurr())) {
- PropagationCounter.getInstance(sparsificationStrategy).countForward();
+ sparsificationStrategy.getCounter().countForwardPropagation();
l.getSuccessor(s);
}
}
+ /*
+ TODO: [ms] reenable sparsification
private SparseAliasingCFG getSparseCFG(Method method, Statement stmt, Val currentVal) {
SootMethod sootMethod = ((JimpleMethod) method).getDelegate();
Stmt sootStmt = ((JimpleStatement) stmt).getDelegate();
@@ -83,6 +82,7 @@ private SparseAliasingCFG getSparseCFG(Method method, Statement stmt, Val curren
sparseCFGCache.getSparseCFGForForwardPropagation(sootMethod, sootStmt, currentVal);
return sparseCFG;
}
+ */
@Override
public void step(Statement curr, Statement succ) {}
diff --git a/boomerangPDS/src/main/java/boomerang/debugger/CallGraphDebugger.java b/boomerangPDS/src/main/java/boomerang/debugger/CallGraphDebugger.java
index df8dc992..6c8dab4d 100644
--- a/boomerangPDS/src/main/java/boomerang/debugger/CallGraphDebugger.java
+++ b/boomerangPDS/src/main/java/boomerang/debugger/CallGraphDebugger.java
@@ -30,17 +30,17 @@ public class CallGraphDebugger extends Debugger {
private static final Logger logger = LoggerFactory.getLogger(CallGraphDebugger.class);
private File dotFile;
- private ObservableICFG icfg;
+ private final ObservableICFG icfg;
private CallGraph callGraph;
- private HashSet totalCallSites = new HashSet<>();
- private Multimap virtualCallSites = HashMultimap.create();
+ private final HashSet totalCallSites = new HashSet<>();
+ private final Multimap virtualCallSites = HashMultimap.create();
private int numVirtualCallSites;
private int numVirtualCallSitesSingleTarget;
private int numVirtualCallSitesMultipleTarget;
private float avgNumTargetsVirtualCallSites;
private float avgNumTargetMultiTargetCallSites;
- private Multimap predecessors = HashMultimap.create();
+ private final Multimap predecessors = HashMultimap.create();
private float avgNumOfPredecessors;
private int numOfEdgesInCallGraph;
private int numEdgesFromPrecomputed;
diff --git a/boomerangPDS/src/main/java/boomerang/debugger/IDEVizDebugger.java b/boomerangPDS/src/main/java/boomerang/debugger/IDEVizDebugger.java
index 3e2b4c6b..f4f522db 100644
--- a/boomerangPDS/src/main/java/boomerang/debugger/IDEVizDebugger.java
+++ b/boomerangPDS/src/main/java/boomerang/debugger/IDEVizDebugger.java
@@ -56,12 +56,13 @@
public class IDEVizDebugger extends Debugger {
- private static boolean ONLY_CFG = false;
+ private static final boolean ONLY_CFG = false;
private static final Logger logger = LoggerFactory.getLogger(IDEVizDebugger.class);
- private File ideVizFile;
+ private final File ideVizFile;
private ObservableICFG icfg;
- private Table, W>>> rules = HashBasedTable.create();
- private Map