From 43c37d6d0eb94427bb7db9b86380785972898f53 Mon Sep 17 00:00:00 2001 From: Julian Dolby Date: Tue, 24 Mar 2015 21:51:35 -0400 Subject: [PATCH] fixes to regression tests: now, for me, code works using e44 with maven dalvik tests refactored for mobile version with android dev tools IDE tests Eclipse metadata fixed to make e44 work for me new android entrypoint to fix failure in new droidbench tests --- .../.settings/org.eclipse.jdt.core.prefs | 1 + .../META-INF/MANIFEST.MF | 1 - .../typeInference/AstJavaTypeInference.java | 6 +- .../test/AbstractFieldBasedTest.java | 2 +- .../launchers/TestMozillaBugPagesRhino.launch | 5 +- ...m.ibm.wala.cast.js.rhino.test-JUnit.launch | 2 +- .../examples-src/tests/214631.js | 2 +- .../examples-src/tests/loops.js | 4 +- .../tests/TestSimpleCallGraphShape.launch | 2 + .../com.ibm.wala.cast.test-JUnit.launch | 2 +- .../{AstConstants.java => CAstBinaryOp.java} | 14 +- .../com/ibm/wala/cast/ir/ssa/CAstUnaryOp.java | 24 + .../cast/ir/translator/AstTranslator.java | 27 +- .../dat/Java60RegressionExclusions.txt | 2 + .../launchers/ExportTypeHierarchyToXML.launch | 28 +- .../launchers/demandpa.launch | 15 - .../launchers/wala.core.launch | 4 +- com.ibm.wala.dalvik.test/pom.xml | 2 +- .../ibm/wala/dalvik/test/DalvikTestBase.java | 38 +- .../callGraph/DalvikCallGraphTestBase.java | 32 +- .../test/callGraph/DroidBenchCGTest.java | 18 +- com.ibm.wala.dalvik/.classpath | 4 +- .../dalvik/classLoader/DexFileModule.java | 27 +- .../classLoader/WDexClassLoaderImpl.java | 2 +- .../instructions/BinaryLiteralOperation.java | 18 +- .../dex/instructions/BinaryOperation.java | 18 +- .../dex/instructions/UnaryOperation.java | 8 +- .../util/config/DexAnalysisScopeReader.java | 6 +- .../dalvik/util/AndroidAnalysisScope.java | 12 +- .../util/androidEntryPoints/ActivityEP.java | 12 + com.ibm.wala.ide.jdt.test/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 7 +- .../META-INF/MANIFEST.MF | 5 +- com.ibm.wala.ide.jdt.test/build.properties | 1 + .../launchers/JDTJava15IRTests.launch | 16 +- com.ibm.wala.ide.jdt.test/pom.xml | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 1 + com.ibm.wala.ide.jdt/META-INF/MANIFEST.MF | 5 +- com.ibm.wala.ide.jsdt.tests/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 7 +- .../META-INF/MANIFEST.MF | 2 +- .../launchers/WLProjectWebScopeTest.launch | 6 +- com.ibm.wala.ide.jsdt.tests/pom.xml | 12 + .../tests/AbstractJSProjectScopeTest.java | 2 +- com.ibm.wala.ide.jsdt/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 7 +- com.ibm.wala.ide.jsdt/META-INF/MANIFEST.MF | 1 + .../com/ibm/wala/ide/util/JsdtUtil.java | 3 +- .../launchers/SWTCallGraph.launch | 1 + com.ibm.wala.ide/META-INF/MANIFEST.MF | 4 +- .../ibm/wala/ide/util/EclipseProjectPath.java | 1 + .../ibm/wala/shrikeCT/AnnotationsReader.java | 2 +- .../com/ibm/wala/util/functions/Function.java | 1 + .../ibm/wala/util/intset/BitVectorIntSet.java | 1 + pom.xml | 436 +++++++++--------- targets/e44/e44.target | 30 +- 56 files changed, 496 insertions(+), 401 deletions(-) rename com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/{AstConstants.java => CAstBinaryOp.java} (73%) create mode 100644 com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/CAstUnaryOp.java delete mode 100644 com.ibm.wala.core.tests/launchers/demandpa.launch diff --git a/com.ibm.wala.cast.java.test.data/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.java.test.data/.settings/org.eclipse.jdt.core.prefs index aa57fa7df..4c8bbd5ba 100644 --- a/com.ibm.wala.cast.java.test.data/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.cast.java.test.data/.settings/org.eclipse.jdt.core.prefs @@ -6,6 +6,7 @@ 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.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 diff --git a/com.ibm.wala.cast.java.test.data/META-INF/MANIFEST.MF b/com.ibm.wala.cast.java.test.data/META-INF/MANIFEST.MF index e46e9112f..4637dac30 100644 --- a/com.ibm.wala.cast.java.test.data/META-INF/MANIFEST.MF +++ b/com.ibm.wala.cast.java.test.data/META-INF/MANIFEST.MF @@ -4,5 +4,4 @@ Bundle-Name: Data Plug-in Bundle-SymbolicName: com.ibm.wala.cast.java.test.data Bundle-Version: 1.3.4.qualifier Bundle-Vendor: IBM -Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/analysis/typeInference/AstJavaTypeInference.java b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/analysis/typeInference/AstJavaTypeInference.java index 431187e20..a115cfc6e 100644 --- a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/analysis/typeInference/AstJavaTypeInference.java +++ b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/analysis/typeInference/AstJavaTypeInference.java @@ -17,7 +17,7 @@ import com.ibm.wala.analysis.typeInference.PrimitiveType; import com.ibm.wala.analysis.typeInference.TypeAbstraction; import com.ibm.wala.analysis.typeInference.TypeVariable; import com.ibm.wala.cast.analysis.typeInference.AstTypeInference; -import com.ibm.wala.cast.ir.ssa.AstConstants; +import com.ibm.wala.cast.ir.ssa.CAstBinaryOp; import com.ibm.wala.cast.java.ssa.AstJavaInstructionVisitor; import com.ibm.wala.cast.java.ssa.AstJavaInvokeInstruction; import com.ibm.wala.cast.java.ssa.EnclosingObjectReference; @@ -40,8 +40,8 @@ public class AstJavaTypeInference extends AstTypeInference { public void visitBinaryOp(SSABinaryOpInstruction instruction) { if (doPrimitives) { IBinaryOpInstruction.IOperator op = instruction.getOperator(); - if (op == AstConstants.BinaryOp.EQ || op == AstConstants.BinaryOp.NE || op == AstConstants.BinaryOp.LT - || op == AstConstants.BinaryOp.GE || op == AstConstants.BinaryOp.GT || op == AstConstants.BinaryOp.LE) { + if (op == CAstBinaryOp.EQ || op == CAstBinaryOp.NE || op == CAstBinaryOp.LT + || op == CAstBinaryOp.GE || op == CAstBinaryOp.GT || op == CAstBinaryOp.LE) { result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(Boolean.TRUE))); } else { result = new PrimAndStringOp(); diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java index 2d221d2a2..ea6719b75 100644 --- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java +++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java @@ -42,7 +42,7 @@ public abstract class AbstractFieldBasedTest extends TestJSCallGraphShape { protected JSCallGraph runTest(URL url, Object[][] assertions, BuilderType... builderTypes) throws IOException, WalaException, Error, CancelException { JSCallGraph cg = null; for(BuilderType builderType : builderTypes) { - ProgressMaster monitor = ProgressMaster.make(new NullProgressMonitor(), 30000, true); + ProgressMaster monitor = ProgressMaster.make(new NullProgressMonitor(), 45000, true); try { cg = util.buildCG(url, builderType, monitor, false).fst; System.err.println(cg); diff --git a/com.ibm.wala.cast.js.rhino.test/launchers/TestMozillaBugPagesRhino.launch b/com.ibm.wala.cast.js.rhino.test/launchers/TestMozillaBugPagesRhino.launch index b3f21cb55..e979be029 100644 --- a/com.ibm.wala.cast.js.rhino.test/launchers/TestMozillaBugPagesRhino.launch +++ b/com.ibm.wala.cast.js.rhino.test/launchers/TestMozillaBugPagesRhino.launch @@ -1,10 +1,10 @@ - + - + @@ -14,6 +14,7 @@ + diff --git a/com.ibm.wala.cast.js.rhino.test/launchers/com.ibm.wala.cast.js.rhino.test-JUnit.launch b/com.ibm.wala.cast.js.rhino.test/launchers/com.ibm.wala.cast.js.rhino.test-JUnit.launch index 82960232b..a0159dc63 100644 --- a/com.ibm.wala.cast.js.rhino.test/launchers/com.ibm.wala.cast.js.rhino.test-JUnit.launch +++ b/com.ibm.wala.cast.js.rhino.test/launchers/com.ibm.wala.cast.js.rhino.test-JUnit.launch @@ -22,7 +22,7 @@ - + diff --git a/com.ibm.wala.cast.js.test.data/examples-src/tests/214631.js b/com.ibm.wala.cast.js.test.data/examples-src/tests/214631.js index 7ef43dd52..9c99218d7 100755 --- a/com.ibm.wala.cast.js.test.data/examples-src/tests/214631.js +++ b/com.ibm.wala.cast.js.test.data/examples-src/tests/214631.js @@ -1,4 +1,4 @@ -// $Id: drupal.js,v 1.41.2.4 2009/07/21 08:59:10 goba Exp $ +// $Id: drupal.js,v 1.41.2.4 2009/07/21 08:59:10 goba Exp $ var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} }; diff --git a/com.ibm.wala.cast.js.test.data/examples-src/tests/loops.js b/com.ibm.wala.cast.js.test.data/examples-src/tests/loops.js index 9d06ef9c5..4379db41a 100644 --- a/com.ibm.wala.cast.js.test.data/examples-src/tests/loops.js +++ b/com.ibm.wala.cast.js.test.data/examples-src/tests/loops.js @@ -12,5 +12,5 @@ var fs2 = []; } })(fs1, fs2); -fs[fs2[2]](); -fs[fs2[3]](); +(fs[fs2[2]])(); +(fs[fs2[3]])(); diff --git a/com.ibm.wala.cast.js.test/tests/TestSimpleCallGraphShape.launch b/com.ibm.wala.cast.js.test/tests/TestSimpleCallGraphShape.launch index 65139c5af..4ca1ceb67 100755 --- a/com.ibm.wala.cast.js.test/tests/TestSimpleCallGraphShape.launch +++ b/com.ibm.wala.cast.js.test/tests/TestSimpleCallGraphShape.launch @@ -10,10 +10,12 @@ + + diff --git a/com.ibm.wala.cast.test/.launchConfigurations/com.ibm.wala.cast.test-JUnit.launch b/com.ibm.wala.cast.test/.launchConfigurations/com.ibm.wala.cast.test-JUnit.launch index 90937f342..53e757ca6 100644 --- a/com.ibm.wala.cast.test/.launchConfigurations/com.ibm.wala.cast.test-JUnit.launch +++ b/com.ibm.wala.cast.test/.launchConfigurations/com.ibm.wala.cast.test-JUnit.launch @@ -11,7 +11,7 @@ - + diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstConstants.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/CAstBinaryOp.java similarity index 73% rename from com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstConstants.java rename to com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/CAstBinaryOp.java index ff47576d5..f1254885f 100644 --- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstConstants.java +++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/CAstBinaryOp.java @@ -13,23 +13,11 @@ package com.ibm.wala.cast.ir.ssa; import com.ibm.wala.shrikeBT.IBinaryOpInstruction; import com.ibm.wala.shrikeBT.IUnaryOpInstruction; -public interface AstConstants { - - public enum BinaryOp implements IBinaryOpInstruction.IOperator { +public enum CAstBinaryOp implements IBinaryOpInstruction.IOperator { CONCAT, EQ, NE, LT, GE, GT, LE, STRICT_EQ, STRICT_NE; @Override public String toString() { return super.toString().toLowerCase(); } - } - - public enum UnaryOp implements IUnaryOpInstruction.IOperator { - MINUS, BITNOT, PLUS; - - @Override - public String toString() { - return super.toString().toLowerCase(); - } - } } diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/CAstUnaryOp.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/CAstUnaryOp.java new file mode 100644 index 000000000..05de50f3f --- /dev/null +++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/CAstUnaryOp.java @@ -0,0 +1,24 @@ +/****************************************************************************** + * Copyright (c) 2002 - 2006 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.cast.ir.ssa; + +import com.ibm.wala.shrikeBT.IBinaryOpInstruction; +import com.ibm.wala.shrikeBT.IUnaryOpInstruction; + + + public enum CAstUnaryOp implements IUnaryOpInstruction.IOperator { + MINUS, BITNOT, PLUS; + + @Override + public String toString() { + return super.toString().toLowerCase(); + } + } diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/translator/AstTranslator.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/translator/AstTranslator.java index 69f030bdc..1e06b25e4 100644 --- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/translator/AstTranslator.java +++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/translator/AstTranslator.java @@ -23,7 +23,6 @@ import java.util.Set; import com.ibm.wala.cast.ir.ssa.AssignInstruction; import com.ibm.wala.cast.ir.ssa.AstAssertInstruction; -import com.ibm.wala.cast.ir.ssa.AstConstants; import com.ibm.wala.cast.ir.ssa.AstEchoInstruction; import com.ibm.wala.cast.ir.ssa.AstGlobalRead; import com.ibm.wala.cast.ir.ssa.AstGlobalWrite; @@ -31,6 +30,8 @@ import com.ibm.wala.cast.ir.ssa.AstIsDefinedInstruction; import com.ibm.wala.cast.ir.ssa.AstLexicalAccess.Access; import com.ibm.wala.cast.ir.ssa.AstLexicalRead; import com.ibm.wala.cast.ir.ssa.AstLexicalWrite; +import com.ibm.wala.cast.ir.ssa.CAstBinaryOp; +import com.ibm.wala.cast.ir.ssa.CAstUnaryOp; import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction; import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction; import com.ibm.wala.cast.ir.ssa.SSAConversion; @@ -3018,13 +3019,13 @@ public abstract class AstTranslator extends CAstVisitor - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/com.ibm.wala.core.tests/launchers/demandpa.launch b/com.ibm.wala.core.tests/launchers/demandpa.launch deleted file mode 100644 index 3abef1bf4..000000000 --- a/com.ibm.wala.core.tests/launchers/demandpa.launch +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - - + - + diff --git a/com.ibm.wala.dalvik.test/pom.xml b/com.ibm.wala.dalvik.test/pom.xml index 54750755e..4e4ee8aca 100644 --- a/com.ibm.wala.dalvik.test/pom.xml +++ b/com.ibm.wala.dalvik.test/pom.xml @@ -75,7 +75,7 @@ junit junit - 4.11 + 4.10 test diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/DalvikTestBase.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/DalvikTestBase.java index 85bc51273..cd9e85dbd 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/DalvikTestBase.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/DalvikTestBase.java @@ -3,12 +3,10 @@ package com.ibm.wala.dalvik.test; import static com.ibm.wala.properties.WalaProperties.ANDROID_RT_JAR; import java.io.File; +import java.io.FileFilter; import java.io.FilenameFilter; import java.io.IOException; -import java.net.MalformedURLException; import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -61,33 +59,37 @@ public abstract class DalvikTestBase extends DynamicCallGraphTestBase { } public static URI[] androidLibs() { + System.err.println(System.getProperty("java.vm.name")); if ("Dalvik".equals(System.getProperty("java.vm.name"))) { - try { - return new URI[]{ - new URL("file:///system/framework/core.jar").toURI(), - new URL("file:///system/framework/framework.jar").toURI(), - new URL("file:///system/framework/framework2.jar").toURI(), - new URL("file:///system/framework/framework3.jar").toURI() - }; - } catch (MalformedURLException e) { - assert false : e; - return null; - } catch (URISyntaxException e) { - assert false : e; - return null; - } + List libs = new ArrayList(); + for(File f : new File("/system/framework/").listFiles(new FileFilter() { + @Override + public boolean accept(File pathname) { + String name = pathname.getName(); + return + (name.startsWith("core") || name.startsWith("framework")) && + (name.endsWith("jar") || name.endsWith("apk")); + } + })) + { + System.out.println("adding " + f); + libs.add(f.toURI()); + } + return libs.toArray(new URI[ libs.size() ]); } else { List libs = new ArrayList(); try { for(File lib : new File(walaProperties.getProperty(ANDROID_RT_JAR)).listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { - return name.endsWith("dex") || name.endsWith("jar"); + return name.endsWith("dex") || name.endsWith("jar") || name.endsWith("apk"); } })) { + System.out.println("adding " + lib); libs.add(lib.toURI()); } } catch (Exception e) { + System.out.println("unexpected " + e); for(String l : WalaProperties.getJ2SEJarFiles()) { libs.add(new File(l).toURI()); } diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DalvikCallGraphTestBase.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DalvikCallGraphTestBase.java index 2ae791171..b0b23f38d 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DalvikCallGraphTestBase.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DalvikCallGraphTestBase.java @@ -15,6 +15,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.InvocationTargetException; +import java.net.URI; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -43,7 +44,6 @@ import com.ibm.wala.ipa.callgraph.propagation.cfa.DefaultSSAInterpreter; import com.ibm.wala.ipa.cha.ClassHierarchy; import com.ibm.wala.ipa.cha.ClassHierarchyException; import com.ibm.wala.ipa.cha.IClassHierarchy; -import com.ibm.wala.properties.WalaProperties; import com.ibm.wala.shrikeBT.analysis.Analyzer.FailureException; import com.ibm.wala.shrikeCT.InvalidClassFileException; import com.ibm.wala.ssa.SSAInstruction; @@ -55,7 +55,6 @@ import com.ibm.wala.util.CancelException; import com.ibm.wala.util.MonitorUtil.IProgressMonitor; import com.ibm.wala.util.NullProgressMonitor; import com.ibm.wala.util.Predicate; -import com.ibm.wala.util.WalaException; import com.ibm.wala.util.collections.FilterIterator; import com.ibm.wala.util.collections.HashSetFactory; import com.ibm.wala.util.collections.MapIterator; @@ -99,18 +98,30 @@ public class DalvikCallGraphTestBase extends DalvikTestBase { run(mainClass.substring(1).replace('/', '.'), "LibraryExclusions.txt", args); } - public static Pair> makeAPKCallGraph(String apkFileName) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { - return makeAPKCallGraph(apkFileName, new NullProgressMonitor()); + public static Pair> makeAPKCallGraph(String apkFile) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException { + return makeAPKCallGraph(apkFile, androidLibs()); + } + + public static Pair> makeAPKCallGraph(String apkFileName, URI[] androidLibs) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { + return makeAPKCallGraph(apkFileName, new NullProgressMonitor(), androidLibs); } - public static Pair> makeAPKCallGraph(String apkFileName, ReflectionOptions options) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { - return makeAPKCallGraph(apkFileName, new NullProgressMonitor(), options); + public static Pair> makeAPKCallGraph(String apkFileName, ReflectionOptions options) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { + return makeAPKCallGraph(apkFileName, new NullProgressMonitor(), options, androidLibs()); + } + + public static Pair> makeAPKCallGraph(String apkFileName, ReflectionOptions options, URI[] androidLibs) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { + return makeAPKCallGraph(apkFileName, new NullProgressMonitor(), options, androidLibs); } - public static Pair> makeAPKCallGraph(String apkFileName, IProgressMonitor monitor) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { - return makeAPKCallGraph(apkFileName, monitor, ReflectionOptions.NONE); + public static Pair> makeAPKCallGraph(String apkFileName, IProgressMonitor monitor, URI[] androidLibs) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { + return makeAPKCallGraph(apkFileName, monitor, ReflectionOptions.NONE, androidLibs); } + public static Pair> makeAPKCallGraph(String absolutePath, IProgressMonitor pm, ReflectionOptions none) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException { + return makeAPKCallGraph(absolutePath, pm, none, androidLibs()); + } + @SuppressWarnings("unused") private static SSAContextInterpreter makeDefaultInterpreter(AnalysisOptions options, AnalysisCache cache) { return new DefaultSSAInterpreter(options, cache) { @@ -137,13 +148,13 @@ public class DalvikCallGraphTestBase extends DalvikTestBase { }; } - public static Pair> makeAPKCallGraph(String apkFileName, IProgressMonitor monitor, ReflectionOptions policy) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { + public static Pair> makeAPKCallGraph(String apkFileName, IProgressMonitor monitor, ReflectionOptions policy, URI[] androidLibs) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { AnalysisScope scope = AndroidAnalysisScope.setUpAndroidAnalysisScope( new File(apkFileName).toURI(), "AndroidRegressionExclusions.txt", CallGraphTestUtil.class.getClassLoader(), - androidLibs()); + androidLibs); final IClassHierarchy cha = ClassHierarchy.make(scope); @@ -199,4 +210,5 @@ public class DalvikCallGraphTestBase extends DalvikTestBase { return Pair.make(callGraph, ptrAnalysis); } + } diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DroidBenchCGTest.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DroidBenchCGTest.java index 28d507a4e..142d5cb3c 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DroidBenchCGTest.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DroidBenchCGTest.java @@ -77,8 +77,9 @@ public abstract class DroidBenchCGTest extends DalvikCallGraphTestBase { uncalledFunctions.put("VirtualDispatch2.apk", x); } - private void assertUserCodeReachable(CallGraph cg) throws InvalidClassFileException { - for(Iterator clss = cg.getClassHierarchy().getLoader(ClassLoaderReference.Application).iterateAllClasses(); + public static Set assertUserCodeReachable(CallGraph cg, Set uncalled) throws InvalidClassFileException { + Set result = HashSetFactory.make(); + for(Iterator clss = cg.getClassHierarchy().getLoader(ClassLoaderReference.Application).iterateAllClasses(); clss.hasNext(); ) { IClass cls = clss.next(); @@ -88,12 +89,16 @@ public abstract class DroidBenchCGTest extends DalvikCallGraphTestBase { if (! cls.getName().toString().startsWith("Landroid") && ! cls.getName().toString().equals("Lde/ecspride/R$styleable")) { for(IMethod m : cls.getDeclaredMethods()) { if (!m.isInit() && !m.isAbstract() && !uncalled.contains(m.getReference())) { - Assert.assertFalse(m + "(" + m.getSourcePosition(0) + ") cannot be called in " + apkFile, cg.getNodes(m.getReference()).isEmpty()); - System.err.println("found " + m); + if (! cg.getNodes(m.getReference()).isEmpty()) { + System.err.println("found " + m); + } else { + result.add(m); + } } } } } + return result; } private final String apkFile; @@ -110,11 +115,12 @@ public abstract class DroidBenchCGTest extends DalvikCallGraphTestBase { System.err.println("testing " + apkFile + "..."); Pair> x = makeAPKCallGraph(apkFile, ReflectionOptions.ONE_FLOW_TO_CASTS_APPLICATION_GET_METHOD); //System.err.println(x.fst); - assertUserCodeReachable(x.fst); + Set bad = assertUserCodeReachable(x.fst, uncalled); + Assert.assertTrue(bad + " should be empty", bad.isEmpty()); System.err.println("...success testing " + apkFile); } - private static final Set skipTests = HashSetFactory.make(); + private static final Set skipTests = HashSetFactory.make(); static { // serialization issues skipTests.add("ServiceCommunication1.apk"); diff --git a/com.ibm.wala.dalvik/.classpath b/com.ibm.wala.dalvik/.classpath index d8fd74849..783737791 100644 --- a/com.ibm.wala.dalvik/.classpath +++ b/com.ibm.wala.dalvik/.classpath @@ -3,12 +3,12 @@ + + - - diff --git a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/DexFileModule.java b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/DexFileModule.java index 1392a1734..fff5f092e 100644 --- a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/DexFileModule.java +++ b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/DexFileModule.java @@ -52,6 +52,7 @@ import java.io.IOException; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; +import java.util.jar.JarFile; import org.jf.dexlib.ClassDefItem; import org.jf.dexlib.DexFile; @@ -61,6 +62,7 @@ import org.slf4j.LoggerFactory; import com.ibm.wala.classLoader.Module; import com.ibm.wala.classLoader.ModuleEntry; +import com.ibm.wala.util.io.TemporaryFile; /** * A module which is a wrapper around .dex and .apk file. @@ -73,12 +75,35 @@ public class DexFileModule implements Module { private final DexFile dexfile; private final Collection entries; + public static DexFileModule make(File f) throws IllegalArgumentException, IOException { + if (f.getName().endsWith("jar")) { + return new DexFileModule(new JarFile(f)); + } else { + return new DexFileModule(f); + } + } + + private static File tf(JarFile f) { + String name = f.getName(); + if (name.indexOf('/') >= 0) { + name = name.substring(name.lastIndexOf('/')+1); + } + File tf = new File(System.getProperty("java.io.tmpdir") + "/" + name + "_classes.dex"); + tf.deleteOnExit(); + System.err.println("using " + tf); + return tf; + } + + private DexFileModule(JarFile f) throws IllegalArgumentException, IOException { + this(TemporaryFile.streamToFile(tf(f), f.getInputStream(f.getEntry("classes.dex")))); + } + /** * @param f * the .dex or .apk file * @throws IllegalArgumentException */ - public DexFileModule(File f) throws IllegalArgumentException { + private DexFileModule(File f) throws IllegalArgumentException { try { dexfile = new DexFile(f); } catch (IOException e) { diff --git a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/WDexClassLoaderImpl.java b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/WDexClassLoaderImpl.java index c9dace4ce..4ea8eeb43 100644 --- a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/WDexClassLoaderImpl.java +++ b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/classLoader/WDexClassLoaderImpl.java @@ -153,7 +153,7 @@ public class WDexClassLoaderImpl extends ClassLoaderImpl { ModuleEntry entry = (ModuleEntry) it.next(); if (entry instanceof DexModuleEntry) { result.add(entry); - } + } } return result; } diff --git a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/BinaryLiteralOperation.java b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/BinaryLiteralOperation.java index bb69dc50c..8619805bb 100644 --- a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/BinaryLiteralOperation.java +++ b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/BinaryLiteralOperation.java @@ -50,7 +50,7 @@ package com.ibm.wala.dalvik.dex.instructions; import org.jf.dexlib.Code.Opcode; -import com.ibm.wala.cast.ir.ssa.AstConstants; +import com.ibm.wala.cast.ir.ssa.CAstBinaryOp; import com.ibm.wala.dalvik.classLoader.DexIMethod; import com.ibm.wala.dalvik.classLoader.Literal; import com.ibm.wala.shrikeBT.IBinaryOpInstruction; @@ -90,21 +90,21 @@ public class BinaryLiteralOperation extends Instruction { switch(op) { case CMPL_FLOAT: - return AstConstants.BinaryOp.LT; + return CAstBinaryOp.LT; case CMPG_FLOAT: - return AstConstants.BinaryOp.GT; + return CAstBinaryOp.GT; case CMPL_DOUBLE: - return AstConstants.BinaryOp.LT; + return CAstBinaryOp.LT; case CMPG_DOUBLE: - return AstConstants.BinaryOp.GT; + return CAstBinaryOp.GT; case CMPL_LONG: - return AstConstants.BinaryOp.LT; + return CAstBinaryOp.LT; case CMPG_LONG: - return AstConstants.BinaryOp.GT; + return CAstBinaryOp.GT; case CMPL_INT: - return AstConstants.BinaryOp.LT; + return CAstBinaryOp.LT; case CMPG_INT: - return AstConstants.BinaryOp.GT; + return CAstBinaryOp.GT; case ADD_INT: return IBinaryOpInstruction.Operator.ADD; case RSUB_INT: diff --git a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/BinaryOperation.java b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/BinaryOperation.java index 9c59461a4..964040a2a 100644 --- a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/BinaryOperation.java +++ b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/BinaryOperation.java @@ -50,7 +50,7 @@ package com.ibm.wala.dalvik.dex.instructions; import org.jf.dexlib.Code.Opcode; -import com.ibm.wala.cast.ir.ssa.AstConstants; +import com.ibm.wala.cast.ir.ssa.CAstBinaryOp; import com.ibm.wala.dalvik.classLoader.DexIMethod; import com.ibm.wala.shrikeBT.IBinaryOpInstruction; import com.ibm.wala.shrikeBT.IShiftInstruction; @@ -89,21 +89,21 @@ public class BinaryOperation extends Instruction { switch(op) { case CMPL_FLOAT: - return AstConstants.BinaryOp.LT; + return CAstBinaryOp.LT; case CMPG_FLOAT: - return AstConstants.BinaryOp.GT; + return CAstBinaryOp.GT; case CMPL_DOUBLE: - return AstConstants.BinaryOp.LT; + return CAstBinaryOp.LT; case CMPG_DOUBLE: - return AstConstants.BinaryOp.GT; + return CAstBinaryOp.GT; case CMPL_LONG: - return AstConstants.BinaryOp.LT; + return CAstBinaryOp.LT; case CMPG_LONG: - return AstConstants.BinaryOp.GT; + return CAstBinaryOp.GT; case CMPL_INT: - return AstConstants.BinaryOp.LT; + return CAstBinaryOp.LT; case CMPG_INT: - return AstConstants.BinaryOp.GT; + return CAstBinaryOp.GT; case ADD_INT: return IBinaryOpInstruction.Operator.ADD; case SUB_INT: diff --git a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/UnaryOperation.java b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/UnaryOperation.java index a88252ab0..c496c4300 100644 --- a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/UnaryOperation.java +++ b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/instructions/UnaryOperation.java @@ -50,7 +50,7 @@ package com.ibm.wala.dalvik.dex.instructions; import org.jf.dexlib.Code.Opcode; -import com.ibm.wala.cast.ir.ssa.AstConstants; +import com.ibm.wala.cast.ir.ssa.CAstUnaryOp; import com.ibm.wala.dalvik.classLoader.DexIMethod; import com.ibm.wala.shrikeBT.IUnaryOpInstruction; import com.ibm.wala.shrikeBT.IUnaryOpInstruction.IOperator; @@ -119,15 +119,15 @@ public class UnaryOperation extends Instruction { { // SSA unary ops case NOT: - return AstConstants.UnaryOp.BITNOT; + return CAstUnaryOp.BITNOT; case NEGINT: return IUnaryOpInstruction.Operator.NEG; case NOTINT: - return AstConstants.UnaryOp.BITNOT; + return CAstUnaryOp.BITNOT; case NEGLONG: return IUnaryOpInstruction.Operator.NEG; case NOTLONG: - return AstConstants.UnaryOp.BITNOT; + return CAstUnaryOp.BITNOT; case NEGFLOAT: return IUnaryOpInstruction.Operator.NEG; case NEGDOUBLE: diff --git a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/util/config/DexAnalysisScopeReader.java b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/util/config/DexAnalysisScopeReader.java index 3b8a1a8c7..be0d2e556 100644 --- a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/util/config/DexAnalysisScopeReader.java +++ b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/dex/util/config/DexAnalysisScopeReader.java @@ -89,10 +89,8 @@ public class DexAnalysisScopeReader extends AnalysisScopeReader { ClassLoaderReference loader = scope.getLoader(AnalysisScope.APPLICATION); final String path = classPath.getPath(); - if (path.endsWith(".jar")) { - scope.addToScope(loader, new JarFile(new File(classPath))); - } else if (path.endsWith(".apk") || path.endsWith(".dex")) { - scope.addToScope(loader, new DexFileModule(new File(classPath))); + if (path.endsWith(".jar") || path.endsWith(".apk") || path.endsWith(".dex")) { + scope.addToScope(loader, DexFileModule.make(new File(classPath))); } else { throw new IOException( "could not determine type of classpath from file extension: " diff --git a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/util/AndroidAnalysisScope.java b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/util/AndroidAnalysisScope.java index 0adbd8bd1..5859ac0ea 100644 --- a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/util/AndroidAnalysisScope.java +++ b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/util/AndroidAnalysisScope.java @@ -47,8 +47,9 @@ public class AndroidAnalysisScope { for(URI al : androidLib) { try { - scope.addToScope(ClassLoaderReference.Primordial, new DexFileModule(new File(al))); + scope.addToScope(ClassLoaderReference.Primordial, DexFileModule.make(new File(al))); } catch (Exception e) { + e.printStackTrace(); scope.addToScope(ClassLoaderReference.Primordial, new JarFileModule(new JarFile(new File(al)))); } } @@ -58,7 +59,7 @@ public class AndroidAnalysisScope { scope.setLoaderImpl(ClassLoaderReference.Application, "com.ibm.wala.dalvik.classLoader.WDexClassLoaderImpl"); - scope.addToScope(ClassLoaderReference.Application, new DexFileModule(new File(classpath))); + scope.addToScope(ClassLoaderReference.Application, DexFileModule.make(new File(classpath))); return scope; } @@ -79,12 +80,11 @@ public class AndroidAnalysisScope { String[] paths = classPath.split(File.pathSeparator); for (int i = 0; i < paths.length; i++) { - if (paths[i].endsWith(".jar")) { // handle jar file - scope.addToScope(loader, new JarFile(paths[i])); - } else if (paths[i].endsWith(".apk") + if (paths[i].endsWith(".jar") + || paths[i].endsWith(".apk") || paths[i].endsWith(".dex")) { // Handle android file. File f = new File(paths[i]); - scope.addToScope(loader, new DexFileModule(f)); + scope.addToScope(loader, DexFileModule.make(f)); } else { File f = new File(paths[i]); if (f.isDirectory()) { // handle directory FIXME not working diff --git a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/util/androidEntryPoints/ActivityEP.java b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/util/androidEntryPoints/ActivityEP.java index e0f8f85b9..321a8442c 100644 --- a/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/util/androidEntryPoints/ActivityEP.java +++ b/com.ibm.wala.dalvik/src/com/ibm/wala/dalvik/util/androidEntryPoints/ActivityEP.java @@ -946,6 +946,17 @@ public final class ActivityEP { } )); + public static final AndroidPossibleEntryPoint onSharedPreferenceChanged = new AndroidPossibleEntryPoint(AndroidComponent.ACTIVITY, + "onSharedPreferenceChanged", + ExecutionOrder.between( // TODO: Find a nice position + new AndroidEntryPoint.IExecutionOrder[] { + onStop + }, + new AndroidEntryPoint.IExecutionOrder[] { + onRestart + } + )); + /** * This method is called before pausing */ @@ -1123,6 +1134,7 @@ public final class ActivityEP { possibleEntryPoints.add(onUserLeaveHint); possibleEntryPoints.add(onWindowAttributesChanged); possibleEntryPoints.add(onWindowFocusChanged); + possibleEntryPoints.add(onSharedPreferenceChanged); } } diff --git a/com.ibm.wala.ide.jdt.test/.classpath b/com.ibm.wala.ide.jdt.test/.classpath index abda64c74..771008c8c 100644 --- a/com.ibm.wala.ide.jdt.test/.classpath +++ b/com.ibm.wala.ide.jdt.test/.classpath @@ -3,6 +3,6 @@ - + diff --git a/com.ibm.wala.ide.jdt.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.ide.jdt.test/.settings/org.eclipse.jdt.core.prefs index 92bf738bc..9365a9bb6 100644 --- a/com.ibm.wala.ide.jdt.test/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.ide.jdt.test/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,10 @@ eclipse.preferences.version=1 instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -72,7 +73,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 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 diff --git a/com.ibm.wala.ide.jdt.test/META-INF/MANIFEST.MF b/com.ibm.wala.ide.jdt.test/META-INF/MANIFEST.MF index 34062f733..2d2f244c1 100644 --- a/com.ibm.wala.ide.jdt.test/META-INF/MANIFEST.MF +++ b/com.ibm.wala.ide.jdt.test/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: com.ibm.wala.cast.java.test;bundle-version="1.0.0", org.eclipse.jdt.core;bundle-version="3.4.2", org.junit;bundle-version="4.0.0", org.eclipse.core.runtime, - org.eclipse.pde.core;bundle-version="3.6.0", - org.eclipse.platform;bundle-version="4.2.2" + org.eclipse.pde.core, + org.eclipse.platform, + org.eclipse.jdt.launching.macosx;resolution:=optional Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/com.ibm.wala.ide.jdt.test/build.properties b/com.ibm.wala.ide.jdt.test/build.properties index 20556c948..84f5eebc3 100644 --- a/com.ibm.wala.ide.jdt.test/build.properties +++ b/com.ibm.wala.ide.jdt.test/build.properties @@ -3,3 +3,4 @@ source.. = source/,\ output.. = bin/ bin.includes = META-INF/,\ . +jre.compilation.profile = JavaSE-1.7 diff --git a/com.ibm.wala.ide.jdt.test/launchers/JDTJava15IRTests.launch b/com.ibm.wala.ide.jdt.test/launchers/JDTJava15IRTests.launch index a8cf585be..8345da487 100644 --- a/com.ibm.wala.ide.jdt.test/launchers/JDTJava15IRTests.launch +++ b/com.ibm.wala.ide.jdt.test/launchers/JDTJava15IRTests.launch @@ -1,5 +1,8 @@ + + + @@ -12,7 +15,9 @@ - + + + @@ -25,6 +30,7 @@ + @@ -34,7 +40,13 @@ - + + + + + + + diff --git a/com.ibm.wala.ide.jdt.test/pom.xml b/com.ibm.wala.ide.jdt.test/pom.xml index c0af20239..196702318 100644 --- a/com.ibm.wala.ide.jdt.test/pom.xml +++ b/com.ibm.wala.ide.jdt.test/pom.xml @@ -9,9 +9,9 @@ 1.3.4-SNAPSHOT + com.ibm.wala.ide.jdt.test eclipse-test-plugin - macosx diff --git a/com.ibm.wala.ide.jdt/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.ide.jdt/.settings/org.eclipse.jdt.core.prefs index 5c4e197c5..9365a9bb6 100644 --- a/com.ibm.wala.ide.jdt/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.ide.jdt/.settings/org.eclipse.jdt.core.prefs @@ -1,6 +1,7 @@ eclipse.preferences.version=1 instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 diff --git a/com.ibm.wala.ide.jdt/META-INF/MANIFEST.MF b/com.ibm.wala.ide.jdt/META-INF/MANIFEST.MF index c0c98e293..bc803ed64 100644 --- a/com.ibm.wala.ide.jdt/META-INF/MANIFEST.MF +++ b/com.ibm.wala.ide.jdt/META-INF/MANIFEST.MF @@ -16,8 +16,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.resources, org.eclipse.jdt.core, org.eclipse.pde.core, - org.eclipse.ui.ide;bundle-version="3.8.2", - org.eclipse.jdt.launching;bundle-version="3.6.101" + org.eclipse.ui.ide, + org.eclipse.jdt.launching, + org.eclipse.jdt Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy Export-Package: com.ibm.wala.cast.java.client, diff --git a/com.ibm.wala.ide.jsdt.tests/.classpath b/com.ibm.wala.ide.jsdt.tests/.classpath index 121e527a9..b277a8ac8 100644 --- a/com.ibm.wala.ide.jsdt.tests/.classpath +++ b/com.ibm.wala.ide.jsdt.tests/.classpath @@ -1,7 +1,7 @@ - + diff --git a/com.ibm.wala.ide.jsdt.tests/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.ide.jsdt.tests/.settings/org.eclipse.jdt.core.prefs index 92bf738bc..9365a9bb6 100644 --- a/com.ibm.wala.ide.jsdt.tests/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.ide.jsdt.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,10 @@ eclipse.preferences.version=1 instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -72,7 +73,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 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 diff --git a/com.ibm.wala.ide.jsdt.tests/META-INF/MANIFEST.MF b/com.ibm.wala.ide.jsdt.tests/META-INF/MANIFEST.MF index fcec5f29b..9f0febef1 100644 --- a/com.ibm.wala.ide.jsdt.tests/META-INF/MANIFEST.MF +++ b/com.ibm.wala.ide.jsdt.tests/META-INF/MANIFEST.MF @@ -19,6 +19,6 @@ Require-Bundle: com.ibm.wala.core;bundle-version="1.1.3", org.eclipse.pde.core;bundle-version="3.8.1", org.eclipse.equinox.common;bundle-version="3.6.100", org.eclipse.core.runtime;bundle-version="3.8.0" -Bundle-ActivationPolicy: lazy Bundle-Activator: com.ibm.wala.ide.jsdt.tests.Activator Export-Package: com.ibm.wala.ide.jsdt.tests +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/com.ibm.wala.ide.jsdt.tests/launchers/WLProjectWebScopeTest.launch b/com.ibm.wala.ide.jsdt.tests/launchers/WLProjectWebScopeTest.launch index 83852bb19..f7661bc66 100644 --- a/com.ibm.wala.ide.jsdt.tests/launchers/WLProjectWebScopeTest.launch +++ b/com.ibm.wala.ide.jsdt.tests/launchers/WLProjectWebScopeTest.launch @@ -14,7 +14,7 @@ - + @@ -24,9 +24,9 @@ - + - + diff --git a/com.ibm.wala.ide.jsdt.tests/pom.xml b/com.ibm.wala.ide.jsdt.tests/pom.xml index 357951ad7..b57734e35 100644 --- a/com.ibm.wala.ide.jsdt.tests/pom.xml +++ b/com.ibm.wala.ide.jsdt.tests/pom.xml @@ -27,4 +27,16 @@ + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + 1 + + + + diff --git a/com.ibm.wala.ide.jsdt.tests/src/com/ibm/wala/ide/jsdt/tests/AbstractJSProjectScopeTest.java b/com.ibm.wala.ide.jsdt.tests/src/com/ibm/wala/ide/jsdt/tests/AbstractJSProjectScopeTest.java index fda5924b7..62dc0c78c 100644 --- a/com.ibm.wala.ide.jsdt.tests/src/com/ibm/wala/ide/jsdt/tests/AbstractJSProjectScopeTest.java +++ b/com.ibm.wala.ide.jsdt.tests/src/com/ibm/wala/ide/jsdt/tests/AbstractJSProjectScopeTest.java @@ -68,7 +68,7 @@ public abstract class AbstractJSProjectScopeTest { return JavaScriptEclipseProjectPath.make(p, Collections.>emptySet()); } - @Ignore("works for me on luna, but ignored for now to avoid breaking juno") + @Ignore("works for me on Eclipse Luna, but I cannot make it work with maven") @Test public void testParsing() throws IOException, CoreException { Set mes = JsdtUtil.getJavaScriptCodeFromProject(project.projectName); diff --git a/com.ibm.wala.ide.jsdt/.classpath b/com.ibm.wala.ide.jsdt/.classpath index bfe5f448e..fc79b4edd 100644 --- a/com.ibm.wala.ide.jsdt/.classpath +++ b/com.ibm.wala.ide.jsdt/.classpath @@ -2,6 +2,6 @@ - + diff --git a/com.ibm.wala.ide.jsdt/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.ide.jsdt/.settings/org.eclipse.jdt.core.prefs index 92bf738bc..9365a9bb6 100644 --- a/com.ibm.wala.ide.jsdt/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.ide.jsdt/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,10 @@ eclipse.preferences.version=1 instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -72,7 +73,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 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 diff --git a/com.ibm.wala.ide.jsdt/META-INF/MANIFEST.MF b/com.ibm.wala.ide.jsdt/META-INF/MANIFEST.MF index 0f3d023f7..14fa5f5cf 100644 --- a/com.ibm.wala.ide.jsdt/META-INF/MANIFEST.MF +++ b/com.ibm.wala.ide.jsdt/META-INF/MANIFEST.MF @@ -22,6 +22,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.pde.core;bundle-version="3.8.1" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy +Import-Package: org.eclipse.wst.jsdt.internal.corext.callhierarchy Export-Package: com.ibm.wala.cast.js.client, com.ibm.wala.ide.jsdt, com.ibm.wala.ide.util diff --git a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JsdtUtil.java b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JsdtUtil.java index 90b33309b..38a6ee76a 100644 --- a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JsdtUtil.java +++ b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JsdtUtil.java @@ -54,6 +54,7 @@ import com.ibm.wala.ide.util.HeadlessUtil.EclipseCompiler; import com.ibm.wala.ide.util.HeadlessUtil.Parser; import com.ibm.wala.ipa.callgraph.AnalysisScope; import com.ibm.wala.util.collections.HashSetFactory; +import com.ibm.wala.util.collections.Pair; import com.ibm.wala.util.functions.Function; import com.ibm.wala.util.graph.Graph; import com.ibm.wala.util.graph.impl.SlowSparseNumberedGraph; @@ -76,7 +77,7 @@ public class JsdtUtil { public static Set getJavaScriptCodeFromProject(String project) throws IOException, CoreException { IJavaScriptProject p = JavaScriptHeadlessUtil.getJavaScriptProjectFromWorkspace(project); JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory()); - AnalysisScope s = JavaScriptEclipseProjectPath.make(p, Collections.EMPTY_SET).toAnalysisScope(new CAstAnalysisScope(JSCallGraphUtil.makeLoaders(), Collections.singleton(JavaScriptLoader.JS))); + AnalysisScope s = JavaScriptEclipseProjectPath.make(p, Collections.>emptySet()).toAnalysisScope(new CAstAnalysisScope(JSCallGraphUtil.makeLoaders(), Collections.singleton(JavaScriptLoader.JS))); List modules = s.getModules(JavaScriptTypes.jsLoader); Set mes = HashSetFactory.make(); diff --git a/com.ibm.wala.ide.tests/launchers/SWTCallGraph.launch b/com.ibm.wala.ide.tests/launchers/SWTCallGraph.launch index 08be6274b..78d71de8d 100644 --- a/com.ibm.wala.ide.tests/launchers/SWTCallGraph.launch +++ b/com.ibm.wala.ide.tests/launchers/SWTCallGraph.launch @@ -6,6 +6,7 @@ + diff --git a/com.ibm.wala.ide/META-INF/MANIFEST.MF b/com.ibm.wala.ide/META-INF/MANIFEST.MF index 22be5e8a4..4cf65db68 100644 --- a/com.ibm.wala.ide/META-INF/MANIFEST.MF +++ b/com.ibm.wala.ide/META-INF/MANIFEST.MF @@ -15,7 +15,9 @@ Require-Bundle: com.ibm.wala.core, org.eclipse.core.resources, org.eclipse.core.runtime, org.eclipse.jdt.core, - org.eclipse.ui.ide;bundle-version="3.8.2" + org.eclipse.ui.ide, + org.eclipse.jdt, + org.eclipse.jdt.launching Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Export-Package: com.ibm.wala.ide.classloader, diff --git a/com.ibm.wala.ide/src/com/ibm/wala/ide/util/EclipseProjectPath.java b/com.ibm.wala.ide/src/com/ibm/wala/ide/util/EclipseProjectPath.java index 9c0705685..b76d8ed62 100644 --- a/com.ibm.wala.ide/src/com/ibm/wala/ide/util/EclipseProjectPath.java +++ b/com.ibm.wala.ide/src/com/ibm/wala/ide/util/EclipseProjectPath.java @@ -201,6 +201,7 @@ public abstract class EclipseProjectPath { if (!model.isInSync() || model.isDisposed()) { model.load(); } + BundleDescription bd = model.getBundleDescription(); if (bd == null) { diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/AnnotationsReader.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/AnnotationsReader.java index cae7cc491..d941a47fe 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/AnnotationsReader.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/AnnotationsReader.java @@ -97,7 +97,7 @@ public class AnnotationsReader extends AttributeReader { @Override public String toString() { - return val.toString(); + return String.valueOf(val); } } diff --git a/com.ibm.wala.util/src/com/ibm/wala/util/functions/Function.java b/com.ibm.wala.util/src/com/ibm/wala/util/functions/Function.java index 58307f8e5..1f5664b83 100644 --- a/com.ibm.wala.util/src/com/ibm/wala/util/functions/Function.java +++ b/com.ibm.wala.util/src/com/ibm/wala/util/functions/Function.java @@ -10,6 +10,7 @@ *******************************************************************************/ package com.ibm.wala.util.functions; + /** */ public interface Function { diff --git a/com.ibm.wala.util/src/com/ibm/wala/util/intset/BitVectorIntSet.java b/com.ibm.wala.util/src/com/ibm/wala/util/intset/BitVectorIntSet.java index 3b112cec2..c257cf63c 100644 --- a/com.ibm.wala.util/src/com/ibm/wala/util/intset/BitVectorIntSet.java +++ b/com.ibm.wala.util/src/com/ibm/wala/util/intset/BitVectorIntSet.java @@ -224,6 +224,7 @@ public final class BitVectorIntSet implements MutableIntSet { @Override public boolean hasNext() { + assert populationCount == bitVector.populationCount(); return count < populationCount; } diff --git a/pom.xml b/pom.xml index 35d5a0648..855d261d4 100644 --- a/pom.xml +++ b/pom.xml @@ -1,218 +1,230 @@ - 4.0.0 - com.ibm.wala - WALA - 1.3.4-SNAPSHOT - pom - - 1.3.4-SNAPSHOT - UTF-8 - b000 - 0.19.0 - scm:git:ssh://github.com:wala/WALA.git - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + 4.0.0 + com.ibm.wala + WALA + 1.3.4-SNAPSHOT + pom + + 1.3.4-SNAPSHOT + UTF-8 + b000 + 0.19.0 + scm:git:ssh://github.com:wala/WALA.git + + + + targets - - targets + com.ibm.wala-feature + com.ibm.wala.core + com.ibm.wala.shrike + com.ibm.wala.util + + com.ibm.wala.core.testdata + com.ibm.wala.core.tests + + com.ibm.wala.cast + com.ibm.wala.cast.test + com.ibm.wala.cast.java + com.ibm.wala.cast.java.test + com.ibm.wala.cast.java.test.data + + com.ibm.wala.ide-feature + com.ibm.wala.ide + com.ibm.wala.ide.tests + + com.ibm.wala.ide.jdt + com.ibm.wala.ide.jdt.test + + com.ibm.wala.cast.js + com.ibm.wala.cast.js.html.nu_validator + com.ibm.wala.cast.js.test + com.ibm.wala.cast.js.test.data + com.ibm.wala.cast.js.rhino + com.ibm.wala.cast.js.rhino.test + + com.ibm.wala.ide.jsdt + com.ibm.wala.ide.jsdt.tests + + com.ibm.wala.dalvik + com.ibm.wala.dalvik.test + + com.ibm.wala.scandroid + + com.ibm.wala.cast.java.polyglot + com.ibm.wala.cast.java.polyglot.test + + com.ibm.wala-repository + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + + + org.eclipse.tycho + target-platform-configuration + ${tycho-version} + + + + com.ibm.wala.target + e44 + ${project-version} + + + + + + org.eclipse.tycho + tycho-compiler-plugin + ${tycho-version} + + 1.7 + 1.7 + -err:-forbidden + + ${project.basedir}/.settings/org.eclipse.jdt.core.prefs + + + + + org.eclipse.tycho + tycho-source-plugin + ${tycho-version} + + + attach-source + process-classes + + plugin-source + + + + + + org.eclipse.tycho + tycho-packaging-plugin + ${tycho-version} + + 'v'yyyyMMdd-HHmm'-${build-alias}' + false + + true + + + + + org.eclipse.tycho.extras + tycho-sourceref-jgit + ${tycho-version} + + + + + org.eclipse.tycho + tycho-surefire-plugin + ${tycho-version} + - com.ibm.wala-feature - com.ibm.wala.core - com.ibm.wala.shrike - com.ibm.wala.util - - com.ibm.wala.core.testdata - com.ibm.wala.core.tests - - com.ibm.wala.dalvik - com.ibm.wala.dalvik.test - com.ibm.wala.scandroid - - com.ibm.wala.cast - com.ibm.wala.cast.test - com.ibm.wala.cast.java - com.ibm.wala.cast.java.test - com.ibm.wala.cast.java.test.data - com.ibm.wala.cast.java.polyglot - com.ibm.wala.cast.java.polyglot.test - com.ibm.wala.cast.js - com.ibm.wala.cast.js.html.nu_validator - com.ibm.wala.cast.js.test - com.ibm.wala.cast.js.test.data - com.ibm.wala.cast.js.rhino - com.ibm.wala.cast.js.rhino.test - - com.ibm.wala.ide-feature - com.ibm.wala.ide - com.ibm.wala.ide.tests - com.ibm.wala.ide.jdt - com.ibm.wala.ide.jsdt - com.ibm.wala.ide.jsdt.tests - com.ibm.wala.ide.jdt.test - - com.ibm.wala-repository - - - - - - - org.eclipse.tycho - tycho-maven-plugin - ${tycho-version} - true - - - org.eclipse.tycho - target-platform-configuration - ${tycho-version} - - - - com.ibm.wala.target - e42 - ${project-version} - - - - - - org.eclipse.tycho - tycho-compiler-plugin - ${tycho-version} - - 1.7 - 1.7 - -err:-forbidden - - ${project.basedir}/.settings/org.eclipse.jdt.core.prefs - - - - - org.eclipse.tycho - tycho-source-plugin - ${tycho-version} - - - attach-source - process-classes - - plugin-source - - - - - - org.eclipse.tycho - tycho-packaging-plugin - ${tycho-version} - - 'v'yyyyMMdd-HHmm'-${build-alias}' - false - - true - - - - - org.eclipse.tycho.extras - tycho-sourceref-jgit - ${tycho-version} - - - - - org.eclipse.tycho - tycho-surefire-plugin - ${tycho-version} - - false - false - junit47 - ${tycho.test.jvmArgs} - - **/Test*.java - **/*Test.java - **/*TestCase.java - **/*Tests.java - - - - - - org.eclipse.tycho.extras - tycho-source-feature-plugin - ${tycho-version} - - - generate-source-feature - - source-feature - - - - - - org.eclipse.tycho - tycho-p2-plugin - ${tycho-version} - - - - default-p2-metadata-default - - false - - - - - attach-p2-metadata - package - - p2-metadata - - - - - - org.eclipse.tycho - tycho-p2-director-plugin - ${tycho-version} - - - org.eclipse.tycho - tycho-p2-repository-plugin - ${tycho-version} - - false - - - - com.googlecode.maven-download-plugin - maven-download-plugin - 1.0.0 - - - org.apache.maven.plugins - maven-surefire-plugin - 2.14.1 - - - - - - sonatype-public-repository - https://oss.sonatype.org/content/groups/public - - true - - - true - - - + + + eclipse-plugin + org.eclipse.osgi.compatibility.state + 0.0.0 + + + false + false + junit47 + ${tycho.test.jvmArgs} + + **/Test*.java + **/*Test.java + **/*TestCase.java + **/*Tests.java + + + + + + org.eclipse.tycho.extras + tycho-source-feature-plugin + ${tycho-version} + + + generate-source-feature + + source-feature + + + + + + org.eclipse.tycho + tycho-p2-plugin + ${tycho-version} + + + + default-p2-metadata-default + + false + + + + + attach-p2-metadata + package + + p2-metadata + + + + + + org.eclipse.tycho + tycho-p2-director-plugin + ${tycho-version} + + + org.eclipse.tycho + tycho-p2-repository-plugin + ${tycho-version} + + true + + + + com.googlecode.maven-download-plugin + maven-download-plugin + 1.0.0 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.14.1 + + + + + + sonatype-public-repository + https://oss.sonatype.org/content/groups/public + + true + + + true + + + diff --git a/targets/e44/e44.target b/targets/e44/e44.target index 9a5c8b27a..f5914a57e 100644 --- a/targets/e44/e44.target +++ b/targets/e44/e44.target @@ -1,30 +1,16 @@ - - - - - - - - - - + - - - - - - - - - - - - + + + + + + +