Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
812aa2c
Use IAnalysisCacheView instead of AnalysisCache. (#1)
khatchad Mar 15, 2017
b9c997b
Increase visibility of several methods and constructors.
khatchad Mar 23, 2017
0e19be8
Ignore the results directory.
khatchad Apr 17, 2017
ea49d92
Some generic type fixes in ModRef.java.
khatchad Apr 24, 2017
481f485
Fix https://github.com/wala/WALA/issues/219.
khatchad Aug 11, 2017
8ea5bd5
Only get symbol table if it is needed.
khatchad Aug 11, 2017
e0a57d0
Only get the variable once.
khatchad Aug 11, 2017
8610355
Only get the variable once.
khatchad Aug 11, 2017
457fd05
Only get symbol table if it is needed.
khatchad Aug 11, 2017
3db4f31
Fix https://github.com/wala/WALA/issues/219.
khatchad Aug 11, 2017
aabd0fc
Add missing void type.
khatchad Aug 24, 2017
74a333f
Missing source class loader reference.
khatchad Aug 28, 2017
e2b2151
Revert "Missing source class loader reference."
khatchad Aug 28, 2017
35165b4
Spelling.
khatchad Aug 28, 2017
588959e
Add IMethod.SourcePosition.getFileName() method.
khatchad Sep 6, 2017
7c11efd
Trying to fix build.
khatchad Sep 6, 2017
37de71b
Remove xvfb for now.
khatchad Sep 6, 2017
9debeae
Fix parse error.
khatchad Sep 6, 2017
5ad7797
Add travis notification.
khatchad Sep 6, 2017
e9d1b06
Use Java 8.
khatchad Sep 6, 2017
f5c0401
Maven fix.
khatchad Sep 21, 2017
d27eb9a
pom.xml fix.
khatchad Oct 5, 2017
79cf2cb
Add library.
Dec 23, 2017
989c92d
Fix https://github.com/wala/WALA/issues/273.
khatchad Dec 19, 2017
be8cb9f
Add JUnit4 capabilities to JUnitEntryPoints.java.
khatchad Jan 18, 2018
d830d18
Merge branch 'streams2' of https://github.com/ponder-lab/WALA into st…
khatchad Feb 1, 2018
1517709
Formatting.
khatchad Feb 1, 2018
b88ee42
Add JUnit5 methods.
khatchad Feb 1, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ target/
com.ibm.wala.dalvik.test/data/sample.cup
com.ibm.wala.dalvik.test/parser.java
com.ibm.wala.dalvik.test/report
com.ibm.wala.dalvik.test/sym.java
com.ibm.wala.dalvik.test/sym.java
results
18 changes: 13 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
language: android
jdk: oraclejdk8
sudo: required
dist: trusty
addons:
apt:
packages:
- xvfb
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
# - "sh -e /etc/init.d/xvfb start"
- "pushd /tmp"
- "git clone --depth=1 https://github.com/secure-software-engineering/DroidBench.git"
- "popd"
Expand All @@ -16,7 +22,9 @@ script:
- ./build-maven-jars.py "install -Dgpg.skip"
sudo: false
cache:
directories:
- $HOME/.m2
- $TRAVIS_BUILD_DIR/com.ibm.wala.core.testdata/ocaml/ocamljava-2.0-alpha1/lib

- apt
- directories:
- $HOME/.m2
- $TRAVIS_BUILD_DIR/com.ibm.wala.core.testdata/ocaml/ocamljava-2.0-alpha1/lib
notifications:
slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji
Binary file added com.ibm.wala.cast/lib/commons-io-2.4.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public Reader getReader() throws IOException {
public String toString() {
return "["+fl+":"+fc+"]->["+ll+":"+lc+"]";
}
@Override
public String getFileName() {
return file.getFile();
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@ public String toString() {
nm = nm.substring(nm.lastIndexOf('/') + 1);
return "[" + nm + ":"+lineNumber+"]";
}

@Override
public String getFileName() {
return this.localFile.getFile();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@ public URL getURL() {
public Reader getReader() throws IOException {
return new InputStreamReader(url.openStream());
}

@Override
public String getFileName() {
return this.url.getFile();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public void substitute(Position range, String newText) {
public Reader getReader() throws IOException {
return hack.getReader();
}
@Override
public String getFileName() {
return hack.getFileName();
}
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
package com.ibm.wala.core.tests.callGraph;

import java.io.IOException;
import java.util.Collection;

import org.junit.Assert;
import org.junit.Test;

import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
Expand Down Expand Up @@ -57,7 +60,7 @@ public class DefaultMethodsTest extends WalaTestCase {
MethodReference t1m = MethodReference.findOrCreate(t1s, "silly", "()I");
Assert.assertTrue("expect Interface1.silly node", cg.getNodes(t1m).iterator().hasNext());
CGNode t1node = cg.getNodes(t1m).iterator().next();

// Check call from main to Interface1.silly
Assert.assertTrue("should have call site from main to Interface1.silly", cg.getPossibleSites(mnode, t1node).hasNext());

Expand All @@ -78,5 +81,13 @@ public class DefaultMethodsTest extends WalaTestCase {

// Check call from main to Test3.silly
Assert.assertTrue("should have call site from main to Test3.silly", cg.getPossibleSites(mnode, ttnode).hasNext());

// Check that IClass.getAllMethods() returns default methods #219.
TypeReference test1Type = TypeReference.findOrCreate(ClassLoaderReference.Application, "LdefaultMethods/DefaultMethods$Test1");
IClass test1Class = cha.lookupClass(test1Type);

Collection<IMethod> allMethods = test1Class.getAllMethods();
IMethod defaultMethod = test1Class.getMethod(t1m.getSelector());
Assert.assertTrue("Expecting default methods to show up in IClass.allMethods()", allMethods.contains(defaultMethod));
}
}
2 changes: 1 addition & 1 deletion com.ibm.wala.core/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="dat"/>
<classpathentry kind="src" path="lib"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
6 changes: 3 additions & 3 deletions com.ibm.wala.core/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand Down Expand Up @@ -119,7 +119,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
Expand Down
2 changes: 1 addition & 1 deletion com.ibm.wala.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ Export-Package: .,
com.ibm.wala.util.warnings,
com.ibm.wala.viz,
com.ibm.wala.viz.viewer
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-BuddyPolicy: registered
Bundle-ClassPath: .
4 changes: 2 additions & 2 deletions com.ibm.wala.core/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<property name="javacVerbose" value="false"/>
<property name="logExtension" value=".log"/>
<property name="compilerArg" value=""/>
<property name="javacSource" value="1.5"/>
<property name="javacTarget" value="1.5"/>
<property name="javacSource" value="1.8"/>
<property name="javacTarget" value="1.8"/>
<condition property="dir_bootclasspath" value="${java.home}/../Classes">
<os family="mac"/>
</condition>
Expand Down
4 changes: 2 additions & 2 deletions com.ibm.wala.core/mvncentral.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class JavaPrimitiveType extends PrimitiveType {

public static final PrimitiveType DOUBLE = makePrimitive(TypeReference.Double, 64);

public static final PrimitiveType VOID = makePrimitive(TypeReference.Void, 0);

public static void init() {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ public class TypeVarFactory implements VariableFactory {

@Override
public IVariable makeVariable(int valueNumber) {
SymbolTable st = ir.getSymbolTable();
if (doPrimitives) {
SymbolTable st = ir.getSymbolTable();
if (st.isConstant(valueNumber)) {
if (st.isBooleanConstant(valueNumber)) {
return new TypeVariable(language.getPrimitive(language.getConstantType(Boolean.TRUE)));
Expand All @@ -752,8 +752,9 @@ public TypeAbstraction getType(int valueNumber) {
if (valueNumber < 0) {
throw new IllegalArgumentException("bad value number " + valueNumber);
}
assert getVariable(valueNumber) != null : "null variable for value number " + valueNumber;
return getVariable(valueNumber).getType();
TypeVariable variable = getVariable(valueNumber);
assert variable != null : "null variable for value number " + valueNumber;
return variable.getType();
}

public TypeAbstraction getConstantType(int valueNumber) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import com.ibm.wala.ipa.cha.ClassHierarchyWarning;
import com.ibm.wala.ipa.cha.IClassHierarchy;
Expand Down Expand Up @@ -396,6 +398,12 @@ public Collection<IMethod> getAllMethods() {
for (IClass i : getDirectInterfaces()) {
result.addAll(i.getAllMethods());
}
} else {
// for non-interfaces, add default methods inherited from interfaces #219.
Set<IMethod> directlyInheritedDefaultMethods = this.getAllImplementedInterfaces().parallelStream()
.flatMap(i -> i.getDeclaredMethods().parallelStream()).filter(m -> !m.isAbstract()).collect(Collectors.toSet());
Logger.getGlobal().finest("Adding default methods: " + directlyInheritedDefaultMethods);
result.addAll(directlyInheritedDefaultMethods);
}
IClass s = getSuperclass();
while (s != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public interface IMethod extends IMember, ContextItem {
/** BEGIN Custom change: precise positions */

public interface SourcePosition extends Comparable {
String getFileName();
int getFirstLine();
int getLastLine();
int getFirstCol();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ public int compareTo(Object o) {
public String toString() {
return fileName + "(" + firstLine + "," + firstCol + "-" + lastLine + "," + lastCol + ")";
}

@Override
public String getFileName() {
return this.fileName;
}
}
/** END Custom change: precise positions */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public static <T> void checkGraphSubset(Graph<T> supG, Graph<T> subG) {
* @param cha governing class hierarchy
* @param scope representation of the analysis scope
*/
public static CallGraphBuilder makeRTABuilder(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha,
public static CallGraphBuilder makeRTABuilder(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha,
AnalysisScope scope) {

addDefaultSelectors(options, cha);
Expand Down Expand Up @@ -432,7 +432,7 @@ public static SSAPropagationCallGraphBuilder makeZeroOneCFABuilder(AnalysisOptio
* @return a 0-CFA Call Graph Builder augmented with extra logic for containers
* @throws IllegalArgumentException if options is null
*/
public static SSAPropagationCallGraphBuilder makeZeroContainerCFABuilder(AnalysisOptions options, AnalysisCache cache,
public static SSAPropagationCallGraphBuilder makeZeroContainerCFABuilder(AnalysisOptions options, IAnalysisCacheView cache,
IClassHierarchy cha, AnalysisScope scope) {

if (options == null) {
Expand All @@ -453,12 +453,12 @@ public static SSAPropagationCallGraphBuilder makeZeroContainerCFABuilder(Analysi
* @return a 0-1-CFA Call Graph Builder augmented with extra logic for containers
* @throws IllegalArgumentException if options is null
*/
public static SSAPropagationCallGraphBuilder makeZeroOneContainerCFABuilder(AnalysisOptions options, AnalysisCache cache,
public static SSAPropagationCallGraphBuilder makeZeroOneContainerCFABuilder(AnalysisOptions options, IAnalysisCacheView cache,
IClassHierarchy cha, AnalysisScope scope) {
return makeZeroOneContainerCFABuilder(options, cache, cha, scope, null, null);
}

public static SSAPropagationCallGraphBuilder makeZeroOneContainerCFABuilder(AnalysisOptions options, AnalysisCache cache,
public static SSAPropagationCallGraphBuilder makeZeroOneContainerCFABuilder(AnalysisOptions options, IAnalysisCacheView cache,
IClassHierarchy cha, AnalysisScope scope, ContextSelector appSelector, SSAContextInterpreter appInterpreter) {

if (options == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ public class PropagationSystem extends DefaultFixedPointSolver<PointsToSetVariab
private PointerAnalysis<InstanceKey> pointerAnalysis;

/**
* Meta-data regarding how pointers are modelled.
* Meta-data regarding how pointers are modeled.
*/
private final PointerKeyFactory pointerKeyFactory;

/**
* Meta-data regarding how instances are modelled.
* Meta-data regarding how instances are modeled.
*/
private final InstanceKeyFactory instanceKeyFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public CallString(CallSiteReference site, IMethod method) {
this.methods = new IMethod[] { method };
}

CallString(CallSiteReference site, IMethod method, int length, CallString base) {
protected CallString(CallSiteReference site, IMethod method, int length, CallString base) {
int sitesLength = Math.min(length, base.sites.length + 1);
int methodsLength = Math.min(length, base.methods.length + 1);
sites = new CallSiteReference[sitesLength];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static class CallStringContextPair implements Context {

private final Context base;

private CallStringContextPair(CallString cs, Context base) {
public CallStringContextPair(CallString cs, Context base) {
this.cs = cs;
this.base = base;
}
Expand Down Expand Up @@ -74,15 +74,15 @@ public CallString getCallString() {
}
};

private final ContextSelector base;
protected final ContextSelector base;

public CallStringContextSelector(ContextSelector base) {
this.base = base;
}

protected abstract int getLength(CGNode caller, CallSiteReference site, IMethod target);

private CallString getCallString(CGNode caller, CallSiteReference site, IMethod target) {
protected CallString getCallString(CGNode caller, CallSiteReference site, IMethod target) {
int length = getLength(caller, site, target);
if (length > 0) {
if (caller.getContext().get(CALL_STRING) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*******************************************************************************/
package com.ibm.wala.ipa.callgraph.propagation.cfa;

import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.impl.DelegatingContextSelector;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
import com.ibm.wala.ipa.cha.IClassHierarchy;
Expand All @@ -29,7 +29,7 @@ public class ZeroXContainerCFABuilder extends ZeroXCFABuilder {
* @param appContextInterpreter application-specific logic to interpret a method in context
* @throws IllegalArgumentException if options is null
*/
public ZeroXContainerCFABuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
public ZeroXContainerCFABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache,
ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, int instancePolicy) {

super(cha, options, cache, appContextSelector, appContextInterpreter, instancePolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.impl.DefaultContextSelector;
import com.ibm.wala.ipa.callgraph.impl.DelegatingContextSelector;
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
Expand Down Expand Up @@ -97,7 +98,7 @@ public abstract class AbstractRTABuilder extends PropagationCallGraphBuilder {
TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/ExceptionInInitializerError"),
TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/NullPointerException") };

protected AbstractRTABuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
protected AbstractRTABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache,
ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter) {
super(cha, options, cache, new DefaultPointerKeyFactory());
setInstanceKeys(new ClassBasedInstanceKeys(options, cha));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.impl.ExplicitCallGraph;
import com.ibm.wala.ipa.callgraph.impl.ExplicitCallGraph.ExplicitNode;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
Expand All @@ -41,7 +42,7 @@
*/
public class BasicRTABuilder extends AbstractRTABuilder {

public BasicRTABuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache, ContextSelector contextSelector,
public BasicRTABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache, ContextSelector contextSelector,
SSAContextInterpreter contextInterpreter) {
super(cha, options, cache, contextSelector, contextInterpreter);
}
Expand Down
Loading