cleanups and changes for TAMU work

This commit is contained in:
Julian Dolby 2017-11-22 18:24:39 -05:00
parent 5faae993e9
commit 45da66a95d
7 changed files with 24 additions and 64 deletions

View File

@ -154,7 +154,7 @@ public class PointsToSetVariable extends IntSetVariable<PointsToSetVariable> {
*
* @param pointerKey The pointerKey to set.
*/
void setPointerKey(PointerKey pointerKey) {
public void setPointerKey(PointerKey pointerKey) {
// check that we haven't modified the hash code!!! this is crucial
assert this.pointerKey.hashCode() == pointerKey.hashCode();
this.pointerKey = pointerKey;

View File

@ -4,7 +4,7 @@
<classpathentry exported="true" kind="lib" path="lib/dexlib2-2.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/util-2.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/guava-22.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-cli-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-cli-1.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-io-2.4.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

View File

@ -86,7 +86,7 @@ Export-Package: com.google.common.annotations,
org.jf.util,
org.jf.util.jcommander
Bundle-ClassPath: .,
lib/commons-cli-1.2.jar,
lib/commons-cli-1.4.jar,
lib/commons-io-2.4.jar,
lib/dexlib2-2.2.1.jar,
lib/util-2.2.1.jar,

View File

@ -1,6 +1,6 @@
bin.includes = META-INF/,\
.,\
lib/commons-cli-1.2.jar,\
lib/commons-cli-1.4.jar,\
lib/commons-io-2.4.jar,\
lib/dexlib2-2.2.1.jar,\
lib/util-2.2.1.jar,\

View File

@ -37,12 +37,12 @@
</target>
<target name="CommonsCliPresent" depends="init">
<available file="${plugin.destination}/lib/commons-cli-1.2.jar" property="commons.cli.present"/>
<available file="${plugin.destination}/lib/commons-cli-1.4.jar" property="commons.cli.present"/>
</target>
<target name="fetchCommonsCli" depends="CommonsCliPresent" unless="commons.cli.present">
<mkdir dir="${plugin.destination}/lib"/>
<get src="http://central.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.jar" dest="${plugin.destination}/lib/commons-cli-1.2.jar" />
<get src="http://central.maven.org/maven2/commons-cli/commons-cli/1.4/commons-cli-1.4.jar" dest="${plugin.destination}/lib/commons-cli-1.4.jar" />
</target>
<target name="DexlibPresent" depends="init">

View File

@ -53,15 +53,14 @@ import java.net.URI;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import com.ibm.wala.ipa.callgraph.AnalysisOptions.ReflectionOptions;
@SuppressWarnings("static-access")
public class CLISCanDroidOptions implements ISCanDroidOptions {
private static final String VERBOSE = "verbose";
private static final String REFLECTION = "reflection";
@ -81,7 +80,7 @@ public class CLISCanDroidOptions implements ISCanDroidOptions {
private static final String PARTIAL_CALL_GRAPH = "partial-call-graph";
private static final String CALL_GRAPH = "call-graph";
private CommandLineParser parser = new PosixParser();
private CommandLineParser parser = new DefaultParser();
private CommandLine line;
private URI classpath;
private String filename;
@ -93,11 +92,11 @@ public class CLISCanDroidOptions implements ISCanDroidOptions {
private final Options options = new Options();
{
options.addOption("h", "help", false, "print this message");
options.addOption(OptionBuilder
.withLongOpt(VERBOSE)
.withDescription(
options.addOption(Option.builder()
.longOpt(VERBOSE)
.desc(
"logging level (default INFO) [OFF, ERROR, WARN, INFO, DEBUG, TRACE, ALL]")
.hasArg().withArgName("level").create());
.hasArg().argName("level").build());
options.addOption("c", CALL_GRAPH, false, "create full call graph pdf");
options.addOption("p", PARTIAL_CALL_GRAPH, false,
"create partial call graph pdf (Application only)");
@ -121,22 +120,22 @@ public class CLISCanDroidOptions implements ISCanDroidOptions {
"run string prefix analysis");
options.addOption("f", SUMMARIES_FILE, true,
"Use the specified summaries xml file");
options.addOption(OptionBuilder
.withLongOpt(TEST_CGB)
.withDescription(
options.addOption(Option.builder()
.longOpt(TEST_CGB)
.desc(
"Only load the call graph, exit status indicates success")
.create());
.build());
options.addOption("y", CHECK_POLICY, false,
"Check conformance with built-in policy");
options.addOption(OptionBuilder.withLongOpt(ANDROID_LIB)
.withDescription("include ALIB in scope of analysis").hasArg()
.withArgName("ALIB").create());
options.addOption(OptionBuilder
.withLongOpt(REFLECTION)
.withDescription(
options.addOption(Option.builder().longOpt(ANDROID_LIB)
.desc("include ALIB in scope of analysis").hasArg()
.argName("ALIB").build());
options.addOption(Option.builder()
.longOpt(REFLECTION)
.desc(
"FULL, NO_FLOW_TO_CASTS, NO_METHOD_INVOKE, NO_FLOW_TO_CASTS_NO_METHOD_INVOKE, ONE_FLOW_TO_CASTS_NO_METHOD_INVOKE, NO_STRING_CONSTANTS, NONE (Default)")
.hasArg().withArgName("option").create());
.hasArg().argName("option").build());
}
public CLISCanDroidOptions(String[] args, boolean reqArgs) {

View File

@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.wala.util.collections;
import java.util.function.Predicate;
/**
* A filter "A or B"
*/
public class OrFilter<T> implements Predicate<T> {
public static <T> OrFilter<T> createOrFilter(Predicate<T> a, Predicate<T> b) {
if (a == null || b == null) {
throw new IllegalArgumentException("cannot compose null filter");
}
return new OrFilter<>(a, b);
}
private final Predicate<T> a;
private final Predicate<T> b;
private OrFilter(Predicate<T> a, Predicate<T> b) {
this.a = a;
this.b = b;
}
@Override public boolean test(T o) {
return a.test(o) || b.test(o);
}
}