From 25c18f0febdf3a04a2574b2a5bda5a7f831d0bfd Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 24 Mar 2020 16:35:29 -0400 Subject: [PATCH 1/3] Fix update site URL. Point it to the mainline. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4db780..b5d44f2 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,4 @@ SAFE static analysis tools ## Eclipse Update Site -https://raw.githubusercontent.com/ponder-lab/safe/master/com.ibm.safe.updatesite +https://raw.githubusercontent.com/tech-srl/safe/master/com.ibm.safe.updatesite From 7241196a0dae6c3b221f6c5b085b20833a877d9a Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 14 Apr 2020 18:24:12 -0400 Subject: [PATCH 2/3] Try to make it work with the latest WALA. Matching https://github.com/wala/WALA/commit/fe68d0231b75b6b7b56cc4107d1a0011e1206991. --- com.ibm.safe.core.tests/.classpath | 2 ++ com.ibm.safe.core.tests/META-INF/MANIFEST.MF | 1 - com.ibm.safe.core/.classpath | 3 +++ com.ibm.safe.core/META-INF/MANIFEST.MF | 4 +--- com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java | 2 +- .../src/com/ibm/safe/callgraph/AllMainEntryPoints.java | 2 +- .../src/com/ibm/safe/callgraph/SelectiveEntryPoints.java | 2 +- .../safe/internal/filtering/AlwaysTrueClassFilter.java | 4 ++-- .../src/com/ibm/safe/internal/filtering/AndFilter.java | 4 ++-- .../src/com/ibm/safe/internal/filtering/OrFilter.java | 4 ++-- .../ibm/safe/internal/filtering/QualifiedNameFilter.java | 4 ++-- .../safe/internal/filtering/RegularExpressionFilter.java | 4 ++-- .../src/com/ibm/safe/metrics/IntHistogram.java | 2 +- com.ibm.safe.lightweight.tests/META-INF/MANIFEST.MF | 1 - com.ibm.safe.lightweight/.classpath | 3 +++ com.ibm.safe.lightweight/META-INF/MANIFEST.MF | 4 +--- .../safe/intraproc/InfiniteRecursionMethodProcessor.java | 2 +- .../ibm/safe/intraproc/sccp/ExpandedControlFlowGraph.java | 7 +++++++ .../lightweight/controller/StructuralSolverRunner.java | 2 +- .../ibm/safe/lightweight/options/IStructuralOptions.java | 2 +- .../ibm/safe/lightweight/options/StructuralOptions.java | 2 +- .../safe/processors/AccessControlProgramProcessor.java | 2 +- .../src/com/ibm/safe/processors/BaseClassProcessor.java | 2 +- .../src/com/ibm/safe/processors/BaseProgramProcessor.java | 2 +- .../safe/secure/accessibility/AccessibilityAnalyzer.java | 8 ++++---- .../src/com/ibm/safe/structural/StructuralSolver.java | 2 +- .../structural/statistics/StatisticsClassProcessor.java | 2 +- .../com/ibm/safe/structural/xml/ClassXMLProcessor.java | 2 +- com.ibm.safe.typestate.tests/META-INF/MANIFEST.MF | 1 - com.ibm.safe.typestate/.classpath | 3 +++ com.ibm.safe.typestate/META-INF/MANIFEST.MF | 4 +--- .../src/com/ibm/safe/typestate/ap/AccessPathSolver.java | 2 +- .../src/com/ibm/safe/typestate/base/BaseSolver.java | 2 +- .../ibm/safe/typestate/core/AbstractTypestateSolver.java | 2 +- .../typestate/local/LocalMustMustNotFlowFunctions.java | 2 +- .../safe/typestate/local/SingleProcedureSupergraph.java | 2 +- .../com/ibm/safe/typestate/rules/InterproceduralCFG.java | 4 ++-- .../safe/typestate/unique/UniqueReturnFlowFunction.java | 2 +- com.ibm.safe/.classpath | 1 + com.ibm.safe/META-INF/MANIFEST.MF | 3 +-- 40 files changed, 59 insertions(+), 50 deletions(-) diff --git a/com.ibm.safe.core.tests/.classpath b/com.ibm.safe.core.tests/.classpath index 121e527..d39100d 100644 --- a/com.ibm.safe.core.tests/.classpath +++ b/com.ibm.safe.core.tests/.classpath @@ -3,5 +3,7 @@ + + diff --git a/com.ibm.safe.core.tests/META-INF/MANIFEST.MF b/com.ibm.safe.core.tests/META-INF/MANIFEST.MF index 1a821ee..d5f8958 100644 --- a/com.ibm.safe.core.tests/META-INF/MANIFEST.MF +++ b/com.ibm.safe.core.tests/META-INF/MANIFEST.MF @@ -5,7 +5,6 @@ Bundle-SymbolicName: com.ibm.safe.core.tests Bundle-Version: 1.0.0.qualifier Export-Package: com.ibm.safe.core.tests Require-Bundle: com.ibm.safe.core;bundle-version="1.0.0", - com.ibm.wala.core;bundle-version="1.1.3", org.eclipse.core.runtime;bundle-version="3.6.0", com.ibm.safe;bundle-version="1.0.0", org.junit;bundle-version="3.8.2" diff --git a/com.ibm.safe.core/.classpath b/com.ibm.safe.core/.classpath index 22f3064..02fef66 100644 --- a/com.ibm.safe.core/.classpath +++ b/com.ibm.safe.core/.classpath @@ -3,5 +3,8 @@ + + + diff --git a/com.ibm.safe.core/META-INF/MANIFEST.MF b/com.ibm.safe.core/META-INF/MANIFEST.MF index 719b3a4..e27e52f 100644 --- a/com.ibm.safe.core/META-INF/MANIFEST.MF +++ b/com.ibm.safe.core/META-INF/MANIFEST.MF @@ -25,9 +25,7 @@ Export-Package: com.ibm.safe, com.ibm.safe.runners, com.ibm.safe.solvers, com.ibm.safe.utils -Require-Bundle: com.ibm.wala.core;bundle-version="1.1.3", - com.ibm.wala.shrike;bundle-version="1.3.1", - org.eclipse.core.runtime;bundle-version="3.6.0", +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.core.resources;bundle-version="3.6.1", com.ibm.wala.ide;bundle-version="1.1.3", org.eclipse.jdt.core;bundle-version="3.8.3", diff --git a/com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java b/com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java index d240e32..8933a78 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java +++ b/com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java @@ -28,7 +28,7 @@ import com.ibm.wala.ssa.SSAAbstractInvokeInstruction; import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.analysis.IExplodedBasicBlock; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; import com.ibm.wala.util.collections.EmptyIterator; import com.ibm.wala.util.collections.FilterIterator; import com.ibm.wala.util.collections.HashMapFactory; diff --git a/com.ibm.safe.core/src/com/ibm/safe/callgraph/AllMainEntryPoints.java b/com.ibm.safe.core/src/com/ibm/safe/callgraph/AllMainEntryPoints.java index b5e8ee1..2a15a1b 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/callgraph/AllMainEntryPoints.java +++ b/com.ibm.safe.core/src/com/ibm/safe/callgraph/AllMainEntryPoints.java @@ -41,7 +41,7 @@ public AllMainEntryPoints(final AnalysisScope analysisScope, final IClassHierarc for (IClass clazz : classHierarchy) { if (!clazz.isInterface() && !clazz.isAbstract() && isApplicationClass(analysisScope, clazz)) { - for (Iterator methodIter = clazz.getDeclaredMethods().iterator(); methodIter.hasNext();) { + for (Iterator methodIter = clazz.getDeclaredMethods().iterator(); methodIter.hasNext();) { final IMethod method = methodIter.next(); if (isMainMethod(method.getReference(), mainMethod, mainDescriptor)) { addPotentiallyMainClass(classHierarchy, mainClassesSelector, clazz, method); diff --git a/com.ibm.safe.core/src/com/ibm/safe/callgraph/SelectiveEntryPoints.java b/com.ibm.safe.core/src/com/ibm/safe/callgraph/SelectiveEntryPoints.java index 81982c7..2681cad 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/callgraph/SelectiveEntryPoints.java +++ b/com.ibm.safe.core/src/com/ibm/safe/callgraph/SelectiveEntryPoints.java @@ -37,7 +37,7 @@ public SelectiveEntryPoints(final AnalysisScope analysisScope, final IClassHiera for (int i = 0; i < entryPointDefs.length; i++) { if (clazz.getName().toString().equals(entryPointDefs[i].getClassName()) && !clazz.isInterface() && isApplicationClass(analysisScope, clazz)) { - for (Iterator methodIter = clazz.getDeclaredMethods().iterator(); methodIter.hasNext();) { + for (Iterator methodIter = clazz.getDeclaredMethods().iterator(); methodIter.hasNext();) { final IMethod method = methodIter.next(); if (!method.isAbstract() && isSameMethod(method.getReference(), entryPointDefs[i].getMethodName(), entryPointDefs[i].getMethodDescriptor())) { diff --git a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/AlwaysTrueClassFilter.java b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/AlwaysTrueClassFilter.java index 82c1ba3..086199a 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/AlwaysTrueClassFilter.java +++ b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/AlwaysTrueClassFilter.java @@ -10,9 +10,9 @@ *******************************************************************************/ package com.ibm.safe.internal.filtering; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; -public final class AlwaysTrueClassFilter extends Predicate { +public final class AlwaysTrueClassFilter implements Predicate { // --- Interface methods implementation diff --git a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/AndFilter.java b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/AndFilter.java index 518024b..b78184a 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/AndFilter.java +++ b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/AndFilter.java @@ -14,9 +14,9 @@ import java.util.LinkedList; import java.util.List; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; -public final class AndFilter extends Predicate { +public final class AndFilter implements Predicate { public AndFilter() { } diff --git a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/OrFilter.java b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/OrFilter.java index 697bd64..7a8941a 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/OrFilter.java +++ b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/OrFilter.java @@ -14,9 +14,9 @@ import java.util.LinkedList; import java.util.List; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; -public final class OrFilter extends Predicate { +public final class OrFilter implements Predicate { public OrFilter() { } diff --git a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/QualifiedNameFilter.java b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/QualifiedNameFilter.java index 4101e46..3fe09d9 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/QualifiedNameFilter.java +++ b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/QualifiedNameFilter.java @@ -11,9 +11,9 @@ package com.ibm.safe.internal.filtering; import com.ibm.wala.classLoader.IClass; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; -public final class QualifiedNameFilter extends Predicate { +public final class QualifiedNameFilter implements Predicate { public QualifiedNameFilter(final String theQualifiedClassName) { this.qualifiedClassName = 'L' + theQualifiedClassName.replace('.', '/'); diff --git a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/RegularExpressionFilter.java b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/RegularExpressionFilter.java index 5980187..226a3cc 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/RegularExpressionFilter.java +++ b/com.ibm.safe.core/src/com/ibm/safe/internal/filtering/RegularExpressionFilter.java @@ -14,9 +14,9 @@ import java.util.regex.Pattern; import com.ibm.wala.classLoader.IClass; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; -public final class RegularExpressionFilter extends Predicate { +public final class RegularExpressionFilter implements Predicate { public RegularExpressionFilter(final String regularExpression) { this.pattern = Pattern.compile(regularExpression); diff --git a/com.ibm.safe.core/src/com/ibm/safe/metrics/IntHistogram.java b/com.ibm.safe.core/src/com/ibm/safe/metrics/IntHistogram.java index 1dfc382..fcc6e6f 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/metrics/IntHistogram.java +++ b/com.ibm.safe.core/src/com/ibm/safe/metrics/IntHistogram.java @@ -17,7 +17,7 @@ import com.ibm.wala.util.collections.HashMapFactory; import com.ibm.wala.util.collections.MapIterator; import com.ibm.wala.util.collections.Pair; -import com.ibm.wala.util.functions.Function; +import java.util.function.Function; /** * This maintains a counter for each non-negative integer this is implemented as diff --git a/com.ibm.safe.lightweight.tests/META-INF/MANIFEST.MF b/com.ibm.safe.lightweight.tests/META-INF/MANIFEST.MF index 379c64d..f2e6220 100644 --- a/com.ibm.safe.lightweight.tests/META-INF/MANIFEST.MF +++ b/com.ibm.safe.lightweight.tests/META-INF/MANIFEST.MF @@ -7,7 +7,6 @@ Bundle-Vendor: IBM Bundle-Localization: plugin Require-Bundle: com.ibm.safe.core, - com.ibm.wala.core, org.eclipse.ui, org.eclipse.core.runtime, org.junit, diff --git a/com.ibm.safe.lightweight/.classpath b/com.ibm.safe.lightweight/.classpath index 751c8f2..07d332f 100644 --- a/com.ibm.safe.lightweight/.classpath +++ b/com.ibm.safe.lightweight/.classpath @@ -3,5 +3,8 @@ + + + diff --git a/com.ibm.safe.lightweight/META-INF/MANIFEST.MF b/com.ibm.safe.lightweight/META-INF/MANIFEST.MF index 08b24a6..677269f 100644 --- a/com.ibm.safe.lightweight/META-INF/MANIFEST.MF +++ b/com.ibm.safe.lightweight/META-INF/MANIFEST.MF @@ -15,7 +15,5 @@ Export-Package: com.ibm.safe.intraproc, com.ibm.safe.structural.xml, com.ibm.safe.lightweight.controller, com.ibm.safe.lightweight.options -Require-Bundle: com.ibm.wala.core, - com.ibm.safe.core, - com.ibm.wala.shrike;bundle-version="1.1.3", +Require-Bundle: com.ibm.safe.core, org.eclipse.core.runtime;bundle-version="3.5.0" diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/intraproc/InfiniteRecursionMethodProcessor.java b/com.ibm.safe.lightweight/src/com/ibm/safe/intraproc/InfiniteRecursionMethodProcessor.java index 77ec458..79031ad 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/intraproc/InfiniteRecursionMethodProcessor.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/intraproc/InfiniteRecursionMethodProcessor.java @@ -44,7 +44,7 @@ import com.ibm.wala.ssa.NullTestPiPolicy; import com.ibm.wala.ssa.SSAPiNodePolicy; import com.ibm.wala.types.MethodReference; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; import com.ibm.wala.util.WalaException; import com.ibm.wala.util.collections.HashSetFactory; import com.ibm.wala.util.graph.Graph; diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/intraproc/sccp/ExpandedControlFlowGraph.java b/com.ibm.safe.lightweight/src/com/ibm/safe/intraproc/sccp/ExpandedControlFlowGraph.java index 5cfdb63..01eb097 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/intraproc/sccp/ExpandedControlFlowGraph.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/intraproc/sccp/ExpandedControlFlowGraph.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Stream; import com.ibm.safe.utils.Trace; import com.ibm.wala.cfg.ControlFlowGraph; @@ -1332,4 +1333,10 @@ public IntSet getPredNodeNumbers(ISSABasicBlock node) { return null; } + public Stream stream() { + // TODO Auto-generated method stub + Assertions.UNREACHABLE(); + return null; + } + } diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/controller/StructuralSolverRunner.java b/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/controller/StructuralSolverRunner.java index 9cf1072..bb06f10 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/controller/StructuralSolverRunner.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/controller/StructuralSolverRunner.java @@ -40,7 +40,7 @@ import com.ibm.wala.classLoader.IClass; import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.util.CancelException; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; public final class StructuralSolverRunner extends AbstractSolverRunner { diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/options/IStructuralOptions.java b/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/options/IStructuralOptions.java index fd77f8e..03d94d6 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/options/IStructuralOptions.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/options/IStructuralOptions.java @@ -12,7 +12,7 @@ import com.ibm.safe.rules.StructuralRule; import com.ibm.wala.classLoader.IClass; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; /** * Base for all options related to structural analysis. diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/options/StructuralOptions.java b/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/options/StructuralOptions.java index b45433a..3061a73 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/options/StructuralOptions.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/lightweight/options/StructuralOptions.java @@ -17,7 +17,7 @@ import com.ibm.safe.rules.IRule; import com.ibm.safe.rules.StructuralRule; import com.ibm.wala.classLoader.IClass; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; public final class StructuralOptions implements IStructuralOptions { diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/processors/AccessControlProgramProcessor.java b/com.ibm.safe.lightweight/src/com/ibm/safe/processors/AccessControlProgramProcessor.java index c393869..4eef3d9 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/processors/AccessControlProgramProcessor.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/processors/AccessControlProgramProcessor.java @@ -17,7 +17,7 @@ import com.ibm.safe.secure.accessibility.AccessibilityAnalyzer; import com.ibm.wala.classLoader.IClass; import com.ibm.wala.ipa.cha.IClassHierarchy; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; public class AccessControlProgramProcessor implements ProgramProcessor { diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/processors/BaseClassProcessor.java b/com.ibm.safe.lightweight/src/com/ibm/safe/processors/BaseClassProcessor.java index 9a532be..8311d83 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/processors/BaseClassProcessor.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/processors/BaseClassProcessor.java @@ -66,7 +66,7 @@ public void process(IClass klass) throws CancelException { processor.setup(klass, classHierarchy); } - for (Iterator methodIterator = klass.getDeclaredMethods().iterator(); methodIterator.hasNext();) { + for (Iterator methodIterator = klass.getDeclaredMethods().iterator(); methodIterator.hasNext();) { IMethod method = methodIterator.next(); if (!J2SEClassHierarchyEngine.isApplicationClass(method.getDeclaringClass())) { diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/processors/BaseProgramProcessor.java b/com.ibm.safe.lightweight/src/com/ibm/safe/processors/BaseProgramProcessor.java index 694fd74..3f39e6a 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/processors/BaseProgramProcessor.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/processors/BaseProgramProcessor.java @@ -27,7 +27,7 @@ import com.ibm.wala.ipa.callgraph.CallGraph; import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.util.CancelException; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; /** * @author Eran Yahav (yahave) diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/secure/accessibility/AccessibilityAnalyzer.java b/com.ibm.safe.lightweight/src/com/ibm/safe/secure/accessibility/AccessibilityAnalyzer.java index e1197d6..e183c32 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/secure/accessibility/AccessibilityAnalyzer.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/secure/accessibility/AccessibilityAnalyzer.java @@ -35,7 +35,7 @@ import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.FieldReference; import com.ibm.wala.types.MethodReference; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; /** * Given the set of classes of Application class loader's name space, the @@ -381,7 +381,7 @@ private Set computeMemberViolations(Map methods = klass.getDeclaredMethods().iterator(); + Iterator methods = klass.getDeclaredMethods().iterator(); while (methods.hasNext()) { IMethod method = (IMethod) methods.next(); AccessibilityTarget target = AccessibilityTarget.getAccessibilityTarget(method); @@ -431,7 +431,7 @@ private Map> computeAccessibility(final AccessibilityTarget target = AccessibilityTarget.getAccessibilityTarget(field); targetsToAccessors.put(target, new ArrayList(3)); } - Iterator methodsIter = klass.getAllMethods().iterator(); + Iterator methodsIter = klass.getAllMethods().iterator(); while (methodsIter.hasNext()) { IMethod method = methodsIter.next(); if (method.isAbstract() || !method.getDeclaringClass().getClassLoader().equals(appLoader) @@ -450,7 +450,7 @@ private Map> computeAccessibility(final if (!J2SEClassHierarchyEngine.isApplicationClass(klass)) { continue; } - Iterator methodsIter = klass.getDeclaredMethods().iterator(); + Iterator methodsIter = klass.getDeclaredMethods().iterator(); while (methodsIter.hasNext()) { IMethod method = methodsIter.next(); try { diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/structural/StructuralSolver.java b/com.ibm.safe.lightweight/src/com/ibm/safe/structural/StructuralSolver.java index a765728..0825207 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/structural/StructuralSolver.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/structural/StructuralSolver.java @@ -38,7 +38,7 @@ import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis; import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.util.CancelException; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; /** * @author Eran Yahav (yahave) diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/structural/statistics/StatisticsClassProcessor.java b/com.ibm.safe.lightweight/src/com/ibm/safe/structural/statistics/StatisticsClassProcessor.java index faaa513..625f9f3 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/structural/statistics/StatisticsClassProcessor.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/structural/statistics/StatisticsClassProcessor.java @@ -76,7 +76,7 @@ public void process(IClass klass) { } programStats.incrementEntry(ProgramStatistics.NUM_CLASSES); - for (Iterator it = klass.getDeclaredMethods().iterator(); it.hasNext();) { + for (Iterator it = klass.getDeclaredMethods().iterator(); it.hasNext();) { IMethod method = (IMethod) it.next(); if (method instanceof ShrikeCTMethod) { ShrikeCTMethod shrikeMethod = (ShrikeCTMethod) method; diff --git a/com.ibm.safe.lightweight/src/com/ibm/safe/structural/xml/ClassXMLProcessor.java b/com.ibm.safe.lightweight/src/com/ibm/safe/structural/xml/ClassXMLProcessor.java index f3aff16..f94bc8b 100644 --- a/com.ibm.safe.lightweight/src/com/ibm/safe/structural/xml/ClassXMLProcessor.java +++ b/com.ibm.safe.lightweight/src/com/ibm/safe/structural/xml/ClassXMLProcessor.java @@ -304,7 +304,7 @@ public void addFieldDefinitions(IClass klass, Document doc, Element fieldsRoot) public void addMethodDefinitions(IClass klass, Document doc, Element methodsRoot) { try { - for (Iterator methodIterator = klass.getDeclaredMethods().iterator(); methodIterator.hasNext();) { + for (Iterator methodIterator = klass.getDeclaredMethods().iterator(); methodIterator.hasNext();) { IMethod method = methodIterator.next(); Element methodElement = addMethod(klass, method, doc); methodsRoot.appendChild(methodElement); diff --git a/com.ibm.safe.typestate.tests/META-INF/MANIFEST.MF b/com.ibm.safe.typestate.tests/META-INF/MANIFEST.MF index 569ea55..2d58c3b 100644 --- a/com.ibm.safe.typestate.tests/META-INF/MANIFEST.MF +++ b/com.ibm.safe.typestate.tests/META-INF/MANIFEST.MF @@ -6,7 +6,6 @@ Bundle-Version: 1.0.0 Bundle-Vendor: IBM Bundle-Localization: plugin Require-Bundle: com.ibm.safe.core, - com.ibm.wala.core, org.eclipse.ui, org.eclipse.core.runtime, org.junit, diff --git a/com.ibm.safe.typestate/.classpath b/com.ibm.safe.typestate/.classpath index 751c8f2..07d332f 100644 --- a/com.ibm.safe.typestate/.classpath +++ b/com.ibm.safe.typestate/.classpath @@ -3,5 +3,8 @@ + + + diff --git a/com.ibm.safe.typestate/META-INF/MANIFEST.MF b/com.ibm.safe.typestate/META-INF/MANIFEST.MF index 698f7db..5013fb0 100644 --- a/com.ibm.safe.typestate/META-INF/MANIFEST.MF +++ b/com.ibm.safe.typestate/META-INF/MANIFEST.MF @@ -24,9 +24,7 @@ Export-Package: com.ibm.safe.accesspath, com.ibm.safe.typestate.staged, com.ibm.safe.typestate.strongUpdate, com.ibm.safe.typestate.unique -Require-Bundle: com.ibm.wala.core, - com.ibm.safe.core, +Require-Bundle: com.ibm.safe.core, org.eclipse.core.runtime;bundle-version="3.4.0", org.eclipse.core.resources;bundle-version="3.4.1", - com.ibm.wala.shrike;bundle-version="1.1.3", com.ibm.wala.ide;bundle-version="1.1.3" diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/ap/AccessPathSolver.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/ap/AccessPathSolver.java index d064f9a..e83e924 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/ap/AccessPathSolver.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/ap/AccessPathSolver.java @@ -51,7 +51,7 @@ import com.ibm.wala.ssa.SSAPhiInstruction; import com.ibm.wala.ssa.SSAPutInstruction; import com.ibm.wala.ssa.SSAReturnInstruction; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; import com.ibm.wala.util.WalaException; import com.ibm.wala.util.collections.CollectionFilter; import com.ibm.wala.util.collections.HashSetFactory; diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/base/BaseSolver.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/base/BaseSolver.java index 5fa8c2a..c1dd59c 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/base/BaseSolver.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/base/BaseSolver.java @@ -37,7 +37,7 @@ import com.ibm.wala.ipa.callgraph.propagation.ConcreteTypeKey; import com.ibm.wala.ipa.callgraph.propagation.InstanceKey; import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; import com.ibm.wala.util.WalaException; import com.ibm.wala.util.collections.CollectionFilter; import com.ibm.wala.util.collections.HashSetFactory; diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/core/AbstractTypestateSolver.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/core/AbstractTypestateSolver.java index b4c9cde..f92aad8 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/core/AbstractTypestateSolver.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/core/AbstractTypestateSolver.java @@ -70,7 +70,7 @@ import com.ibm.wala.ssa.analysis.IExplodedBasicBlock; import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.util.CancelException; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; import com.ibm.wala.util.WalaException; import com.ibm.wala.util.collections.CollectionFilter; import com.ibm.wala.util.collections.HashSetFactory; diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/local/LocalMustMustNotFlowFunctions.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/local/LocalMustMustNotFlowFunctions.java index d55868a..f75b060 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/local/LocalMustMustNotFlowFunctions.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/local/LocalMustMustNotFlowFunctions.java @@ -43,7 +43,7 @@ import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.SSAInvokeInstruction; import com.ibm.wala.ssa.analysis.IExplodedBasicBlock; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; import com.ibm.wala.util.collections.FilterIterator; import com.ibm.wala.util.intset.MutableSparseIntSet; import com.ibm.wala.util.intset.OrdinalSet; diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/local/SingleProcedureSupergraph.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/local/SingleProcedureSupergraph.java index f79cb36..db7725a 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/local/SingleProcedureSupergraph.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/local/SingleProcedureSupergraph.java @@ -29,7 +29,7 @@ import com.ibm.wala.util.collections.EmptyIterator; import com.ibm.wala.util.collections.MapIterator; import com.ibm.wala.util.debug.Assertions; -import com.ibm.wala.util.functions.Function; +import java.util.function.Function; import com.ibm.wala.util.graph.Graph; import com.ibm.wala.util.intset.IntSet; diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/rules/InterproceduralCFG.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/rules/InterproceduralCFG.java index dc8ac76..36dd8a9 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/rules/InterproceduralCFG.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/rules/InterproceduralCFG.java @@ -30,14 +30,14 @@ import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.MethodReference; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; import com.ibm.wala.util.collections.FilterIterator; import com.ibm.wala.util.collections.HashSetFactory; import com.ibm.wala.util.collections.IndiscriminateFilter; import com.ibm.wala.util.collections.MapIterator; import com.ibm.wala.util.debug.Assertions; import com.ibm.wala.util.debug.UnimplementedError; -import com.ibm.wala.util.functions.Function; +import java.util.function.Function; import com.ibm.wala.util.graph.GraphIntegrity; import com.ibm.wala.util.graph.GraphIntegrity.UnsoundGraphException; import com.ibm.wala.util.graph.NumberedGraph; diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/unique/UniqueReturnFlowFunction.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/unique/UniqueReturnFlowFunction.java index f084a90..b45cf57 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/unique/UniqueReturnFlowFunction.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/unique/UniqueReturnFlowFunction.java @@ -24,7 +24,7 @@ import com.ibm.wala.ipa.callgraph.propagation.LocalPointerKey; import com.ibm.wala.ipa.callgraph.propagation.PointerKey; import com.ibm.wala.ssa.IR; -import com.ibm.wala.util.Predicate; +import java.util.function.Predicate; import com.ibm.wala.util.collections.FilterIterator; import com.ibm.wala.util.intset.IntSet; import com.ibm.wala.util.intset.MutableSparseIntSet; diff --git a/com.ibm.safe/.classpath b/com.ibm.safe/.classpath index 121e527..e19357f 100644 --- a/com.ibm.safe/.classpath +++ b/com.ibm.safe/.classpath @@ -3,5 +3,6 @@ + diff --git a/com.ibm.safe/META-INF/MANIFEST.MF b/com.ibm.safe/META-INF/MANIFEST.MF index 7e8ca6f..e18827f 100644 --- a/com.ibm.safe/META-INF/MANIFEST.MF +++ b/com.ibm.safe/META-INF/MANIFEST.MF @@ -8,5 +8,4 @@ Require-Bundle: com.ibm.safe.core;bundle-version="1.0.0", org.eclipse.core.runtime;bundle-version="3.6.0", com.ibm.safe.typestate;bundle-version="1.0.0", com.ibm.safe.lightweight;bundle-version="1.0.0", - org.eclipse.core.resources;bundle-version="3.6.1", - com.ibm.wala.util;bundle-version="1.3.4" + org.eclipse.core.resources;bundle-version="3.6.1" From 50fdcbec022ff1a53e37b9176f7f4b368fd7599a Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 16 Apr 2020 12:14:38 -0400 Subject: [PATCH 3/3] Make SAFE work with latest WALA. Matching https://github.com/wala/WALA/commit/fe68d0231b75b6b7b56cc4107d1a0011e1206991. --- .../src/com/ibm/safe/ICFGSupergraph.java | 10 +++++++++- .../com/ibm/safe/callgraph/CHABasedCallGraph.java | 3 ++- .../src/com/ibm/safe/callgraph/CallGraphEngine.java | 3 ++- .../com/ibm/safe/callgraph/CustomCICFABuilder.java | 3 ++- .../src/com/ibm/safe/typestate/core/TwoExitCFG.java | 7 +++++++ .../ibm/safe/typestate/metrics/TypeStateMetrics.java | 2 +- .../com/ibm/safe/typestate/mine/TracingProperty.java | 2 +- .../ibm/safe/typestate/rules/InterproceduralCFG.java | 12 ++++++++++-- 8 files changed, 34 insertions(+), 8 deletions(-) diff --git a/com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java b/com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java index 8933a78..1df5ca2 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java +++ b/com.ibm.safe.core/src/com/ibm/safe/ICFGSupergraph.java @@ -29,6 +29,8 @@ import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.analysis.IExplodedBasicBlock; import java.util.function.Predicate; +import java.util.stream.Stream; + import com.ibm.wala.util.collections.EmptyIterator; import com.ibm.wala.util.collections.FilterIterator; import com.ibm.wala.util.collections.HashMapFactory; @@ -66,7 +68,7 @@ public static ICFGSupergraph make(CallGraph cg, AnalysisCache cache) { return w; } - public Graph getProcedureGraph() { + public Graph getProcedureGraph() { return icfg.getCallGraph(); } @@ -292,4 +294,10 @@ public String toString() { return icfg.toString(); } + @Override + public Stream> stream() { + // TODO Auto-generated method stub + Assertions.UNREACHABLE(); + return null; + } } diff --git a/com.ibm.safe.core/src/com/ibm/safe/callgraph/CHABasedCallGraph.java b/com.ibm.safe.core/src/com/ibm/safe/callgraph/CHABasedCallGraph.java index 38b1642..2df50c9 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/callgraph/CHABasedCallGraph.java +++ b/com.ibm.safe.core/src/com/ibm/safe/callgraph/CHABasedCallGraph.java @@ -24,6 +24,7 @@ import com.ibm.wala.classLoader.CallSiteReference; import com.ibm.wala.classLoader.IClass; import com.ibm.wala.classLoader.IMethod; +import com.ibm.wala.classLoader.Language; import com.ibm.wala.ipa.callgraph.AnalysisCache; import com.ibm.wala.ipa.callgraph.AnalysisOptions; import com.ibm.wala.ipa.callgraph.CGNode; @@ -50,7 +51,7 @@ public class CHABasedCallGraph extends ExplicitCallGraph { public CHABasedCallGraph(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) { - super(cha, options, cache); + super(Language.JAVA.getFakeRootMethod(cha, options, cache), options, cache); setInterpreter(new ContextInsensitiveSSAInterpreter(options, cache)); // Create nodes for methods in classes found by CHA. diff --git a/com.ibm.safe.core/src/com/ibm/safe/callgraph/CallGraphEngine.java b/com.ibm.safe.core/src/com/ibm/safe/callgraph/CallGraphEngine.java index 76480d2..4cbd115 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/callgraph/CallGraphEngine.java +++ b/com.ibm.safe.core/src/com/ibm/safe/callgraph/CallGraphEngine.java @@ -25,6 +25,7 @@ import com.ibm.safe.perf.PerformanceTracker.Stages; import com.ibm.safe.utils.Trace; import com.ibm.wala.classLoader.IClass; +import com.ibm.wala.classLoader.Language; import com.ibm.wala.client.AbstractAnalysisEngine; import com.ibm.wala.ide.util.ProgressMonitorDelegate; import com.ibm.wala.ipa.callgraph.AnalysisCache; @@ -143,7 +144,7 @@ public CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions Trace.println("Using RTA Builder"); break; case ZERO_CFA: - builder = Util.makeZeroCFABuilder(options, cache, cha, getScope()); + builder = Util.makeZeroCFABuilder(Language.JAVA, options, cache, cha, getScope()); Trace.println("Using 0-CFA Builder"); break; case ZERO_ONE_CFA: diff --git a/com.ibm.safe.core/src/com/ibm/safe/callgraph/CustomCICFABuilder.java b/com.ibm.safe.core/src/com/ibm/safe/callgraph/CustomCICFABuilder.java index 0e1b20c..7c923f1 100644 --- a/com.ibm.safe.core/src/com/ibm/safe/callgraph/CustomCICFABuilder.java +++ b/com.ibm.safe.core/src/com/ibm/safe/callgraph/CustomCICFABuilder.java @@ -10,6 +10,7 @@ *******************************************************************************/ package com.ibm.safe.callgraph; +import com.ibm.wala.classLoader.Language; import com.ibm.wala.ipa.callgraph.AnalysisCache; import com.ibm.wala.ipa.callgraph.AnalysisOptions; import com.ibm.wala.ipa.callgraph.ContextSelector; @@ -39,7 +40,7 @@ public class CustomCICFABuilder extends ZeroXCFABuilder { */ public CustomCICFABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache, ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter) { - super(cha, options, cache, appContextSelector, appContextInterpreter, ZeroXInstanceKeys.ALLOCATIONS + super(Language.JAVA, cha, options, cache, appContextSelector, appContextInterpreter, ZeroXInstanceKeys.ALLOCATIONS | ZeroXInstanceKeys.SMUSH_MANY | ZeroXInstanceKeys.SMUSH_PRIMITIVE_HOLDERS | ZeroXInstanceKeys.SMUSH_STRINGS | ZeroXInstanceKeys.SMUSH_THROWABLES); } diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/core/TwoExitCFG.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/core/TwoExitCFG.java index 81ef8b5..b38b121 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/core/TwoExitCFG.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/core/TwoExitCFG.java @@ -15,6 +15,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.stream.Stream; import com.ibm.safe.utils.Trace; import com.ibm.wala.cfg.AbstractCFG; @@ -601,4 +602,10 @@ public IntSet getPredNodeNumbers(ISSABasicBlock node) throws UnimplementedError public ControlFlowGraph getDelegate() { return delegate; } + + @Override + public Stream stream() { + // TODO Auto-generated method stub + return null; + } } diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/metrics/TypeStateMetrics.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/metrics/TypeStateMetrics.java index 83e80c6..1328929 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/metrics/TypeStateMetrics.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/metrics/TypeStateMetrics.java @@ -126,7 +126,7 @@ private TypeStateMetricsByLoader compute(final IClassHierarchy classHierarchy, f final IClass clazz = iter.next(); ++numberOfClasses; - for (Iterator iterator = clazz.getDeclaredMethods().iterator(); iterator.hasNext();) { + for (Iterator iterator = clazz.getDeclaredMethods().iterator(); iterator.hasNext();) { final IMethod method = iterator.next(); ++numberOfMethods; diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/mine/TracingProperty.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/mine/TracingProperty.java index 326da47..1a7bc1e 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/mine/TracingProperty.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/mine/TracingProperty.java @@ -81,7 +81,7 @@ private void populateEventMap(Collection klasses) { private void populateEventMap(IClass klass) { try { - for (Iterator it = klass.getAllMethods().iterator(); it.hasNext();) { + for (Iterator it = klass.getAllMethods().iterator(); it.hasNext();) { IMethod m = it.next(); if (isInterestingMethod(m)) { String name = getEventName(m); diff --git a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/rules/InterproceduralCFG.java b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/rules/InterproceduralCFG.java index 36dd8a9..ce7d925 100644 --- a/com.ibm.safe.typestate/src/com/ibm/safe/typestate/rules/InterproceduralCFG.java +++ b/com.ibm.safe.typestate/src/com/ibm/safe/typestate/rules/InterproceduralCFG.java @@ -31,6 +31,8 @@ import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.MethodReference; import java.util.function.Predicate; +import java.util.stream.Stream; + import com.ibm.wala.util.collections.FilterIterator; import com.ibm.wala.util.collections.HashSetFactory; import com.ibm.wala.util.collections.IndiscriminateFilter; @@ -879,10 +881,10 @@ public Iterator> getCallSites(BasicBlockInCo throw new IllegalArgumentException("bb is null"); } final ControlFlowGraph cfg = getCFG(returnBlock); - Iterator it = cfg.getPredNodes(returnBlock.getDelegate()); + Iterator it = cfg.getPredNodes(returnBlock.getDelegate()); final CGNode node = returnBlock.getNode(); - Predicate dispatchFilter = new Predicate() { + Predicate dispatchFilter = new Predicate() { public boolean test(ISSABasicBlock callBlock) { BasicBlockInContext bb = new BasicBlockInContext(node, callBlock); if (!hasCall(bb, cfg)) { @@ -908,4 +910,10 @@ public BasicBlockInContext apply(ISSABasicBlock object) { return new FilterIterator>(m, isCall); } + @Override + public Stream stream() { + // TODO Auto-generated method stub + Assertions.UNREACHABLE(); + return null; + } }