diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 000000000..e45dc3fe0
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,6 @@
+((groovy-mode
+ (c-file-style . "bsd")))
+
+;; Local variables:
+;; flycheck-disabled-checkers: (emacs-lisp emacs-lisp-checkdoc)
+;; End:
diff --git a/.gitignore b/.gitignore
index 22b0d3901..29ff470e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,42 +4,48 @@
*.swp
*/bin/
*/bin/*
+*/build/
*~
+.classpath
.metadata/
-com.ibm.wala.cast/lib/
-com.ibm.wala.cast.java.jdt.test/
-com.ibm.wala.cast.java.polyglot/lib/
-com.ibm.wala.cast.java.test.data/src/JLex/
-com.ibm.wala.cast.java.test/testdata/
-com.ibm.wala.cast.js.html.nu_validator/lib/
-com.ibm.wala.cast.js.nodejs/lib/
-com.ibm.wala.cast.js.rhino.test/*.dump
-com.ibm.wala.cast.js.rhino.test/*.html*
-com.ibm.wala.cast.js.rhino.test/2009_swine_flu_outbreak
-com.ibm.wala.cast.js.rhino.test/?game*
-com.ibm.wala.cast.js.rhino.test/BunnyHunt
-com.ibm.wala.cast.js.rhino.test/digg_attack
-com.ibm.wala.cast.js.rhino.test/game.php*
-com.ibm.wala.cast.js.rhino.test/xxxx
-com.ibm.wala.cast.js.rhino/lib/
-com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
-com.ibm.wala.cast.js.test/examples-src/ajaxslt/
-com.ibm.wala.cast.js/lib/
-com.ibm.wala.core.testdata/*.jar
-com.ibm.wala.core.testdata/@dot/
-com.ibm.wala.core.testdata/lib/
-com.ibm.wala.core.testdata/ocaml/
-com.ibm.wala.core.tests/dat/wala.examples.properties
-com.ibm.wala.core.tests/report
-com.ibm.wala.core/@dot
-com.ibm.wala.core/com.ibm.wala.core*.jar
-com.ibm.wala.core/dat/wala.properties
-com.ibm.wala.dalvik/src/logback.xml
-com.ibm.wala.ide.jdt.test/testdata/
-edu.kit.wala.smali.test/out/
+.project
+/*/.settings/org.eclipse.buildship.core.prefs
+/.gradle/
+/.settings/org.eclipse.buildship.core.prefs
+/.vscode/settings.json
+/build/
+/com.ibm.wala.*/out/
+/com.ibm.wala.cast.java.jdt.test/
+/com.ibm.wala.cast.java.polyglot/lib/
+/com.ibm.wala.cast.java.test.data/src/JLex/
+/com.ibm.wala.cast.java.test/testdata/
+/com.ibm.wala.cast.js.html.nu_validator/lib/
+/com.ibm.wala.cast.js.nodejs/lib/
+/com.ibm.wala.cast.js.rhino.test/*.dump
+/com.ibm.wala.cast.js.rhino.test/*.html*
+/com.ibm.wala.cast.js.rhino.test/2009_swine_flu_outbreak
+/com.ibm.wala.cast.js.rhino.test/?game*
+/com.ibm.wala.cast.js.rhino.test/BunnyHunt
+/com.ibm.wala.cast.js.rhino.test/digg_attack
+/com.ibm.wala.cast.js.rhino.test/game.php*
+/com.ibm.wala.cast.js.rhino.test/xxxx
+/com.ibm.wala.cast.js.rhino/lib/
+/com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
+/com.ibm.wala.cast.js.test/examples-src/ajaxslt/
+/com.ibm.wala.cast.js/lib/
+/com.ibm.wala.cast/lib/
+/com.ibm.wala.core.testdata/*.jar
+/com.ibm.wala.core.testdata/@dot/
+/com.ibm.wala.core.testdata/lib/
+/com.ibm.wala.core.tests/report
+/com.ibm.wala.core/@dot
+/com.ibm.wala.core/com.ibm.wala.core*.jar
+/com.ibm.wala.core/dat/wala.properties
+/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.ide.jdt.test/testdata/
+/edu.kit.wala.smali.test/out/
+results
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
-results
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 000000000..65f86d623
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,6 @@
+*.iml
+/libraries/*.xml
+/modules.xml
+/tasks.xml
+/usage.statistics.xml
+/workspace.xml
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 000000000..147050681
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 000000000..12c099175
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/After_Opening_Pristine_Project.xml b/.idea/runConfigurations/After_Opening_Pristine_Project.xml
new file mode 100644
index 000000000..c3277521c
--- /dev/null
+++ b/.idea/runConfigurations/After_Opening_Pristine_Project.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..35eb1ddfb
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index bb2df4e32..235c0d0c0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,30 +1,23 @@
-language: android
+sudo: false
android:
components:
- build-tools-26.0.2
-jdk: oraclejdk8
addons:
apt:
packages:
- realpath
- xvfb
before_install:
-- echo $ANDROID_HOME
-- git clone --depth=1 https://github.com/secure-software-engineering/DroidBench.git /tmp/DroidBench
-- export M2_HOME=$HOME/apache-maven-3.5.0
-- if [ ! -d $M2_HOME/bin ]; then curl https://archive.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz | tar zxf - -C $HOME; fi
-- export PATH=$M2_HOME/bin:$PATH
-install:
-- mvn clean verify -DskipTests=true -B -q
-script:
-- xvfb-run mvn clean install -B -q
-- bash ./dependent-projects-trigger.sh $AUTH_TOKEN
-- mvn javadoc:aggregate -B -q
-- bash ./upload-javascript.sh $GH_TOKEN
-- ./build-maven-jars.py "install -Dgpg.skip"
-sudo: false
+ - set -e
+ - source "travis/before-install-$BUILD_SYSTEM"
+install: source "travis/install-$BUILD_SYSTEM"
+script: source "travis/script-$BUILD_SYSTEM"
+before_cache: source "travis/before-cache-$BUILD_SYSTEM"
cache:
directories:
+ - "$HOME/.goomph"
+ - "$HOME/.gradle/caches"
+ - "$HOME/.gradle/wrapper"
- "$HOME/.m2"
- "$HOME/apache-maven-3.5.0"
- "$TRAVIS_BUILD_DIR/com.ibm.wala.core.testdata/ocaml/ocamljava-2.0-alpha1/lib"
@@ -32,3 +25,297 @@ env:
global:
- secure: KcugjQYnBqeZ7XenZD5QY7jhekVPO0QpQyjDUteLytaokhyRK2g6eNvr/pPerN2uWUvsPwO18P9F+oOupge1cpPZf4cEY8RzLIromyUoRWd6JA0SKciUYdN2kSqnC4uZSJGXeGLoroyEEL4Q2sqimpkbIGxgxYtVniWgJULOyR4=
- secure: jacvGPYX4ugG/HgwJEEpWnllWsS/ipX+qRJ7qM5mbDYryeqsz0eiaxBxQ6IpDyj0v6O4DUi74lSQs/UxCWcUxvOn/5AweCZfoF1U8vt1xivanR4MbC2kr6rJ6ohICuJ4PHDS4IffncgaP3Y8cfExHq6+d0tbibYkjRIiMUGpSik=
+matrix:
+ include:
+ - os: linux
+ env: BUILD_SYSTEM=gradle
+ language: java
+ jdk: oraclejdk8
+ - os: linux
+ env: BUILD_SYSTEM=maven
+ language: android
+ jdk: oraclejdk8
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle
+ language: java
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.ecj
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.test
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.test.data
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.html.nu_validator
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.nodejs
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.nodejs.test
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.rhino
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.rhino.test
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.test
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.test.data
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.test
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core.testdata
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core.tests
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.dalvik
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.dalvik.test
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jdt
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jdt.test
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jsdt
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jsdt.tests
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.tests
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.scandroid
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.shrike
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: linux
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.util
+ language: java
+ jdk: oraclejdk8
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.ecj
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.test
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.test.data
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.html.nu_validator
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.nodejs
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.nodejs.test
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.rhino
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.rhino.test
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.test
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.test.data
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.test
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core.testdata
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core.tests
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.dalvik
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.dalvik.test
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jdt
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jdt.test
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jsdt
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jsdt.tests
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.tests
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.scandroid
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.shrike
+ language: java
+ if: type = cron
+ - os: osx
+ osx_image: xcode8.3
+ env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.util
+ language: java
+ if: type = cron
diff --git a/After Importing WALA Into Eclipse.launch b/After Importing WALA Into Eclipse.launch
new file mode 100644
index 000000000..8db91ffe4
--- /dev/null
+++ b/After Importing WALA Into Eclipse.launch
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README-Gradle.md b/README-Gradle.md
new file mode 100644
index 000000000..e2f26e400
--- /dev/null
+++ b/README-Gradle.md
@@ -0,0 +1,340 @@
+This document describes some WALA-specific aspects of our new Gradle
+build system, plus a few general Gradle features that may be of
+particular interest to WALA developers. However, it is not a Gradle
+tutorial.
+
+# Pros and Cons of Switching to Gradle
+
+## Selected Gradle Advantages in Brief
+
+- [more comprehensive management of external
+ dependencies](#comprehensive-external-dependencies)
+- faster builds using [parallel task
+ execution](https://docs.gradle.org/current/userguide/multi_project_builds.html#sec:parallel_execution)
+ and [user-scoped
+ caching](https://docs.gradle.org/current/userguide/build_cache.html)
+ (both enabled by default)
+- [trustworthy dependencies for incremental
+ builds](#trustworthy-dependencies-for-incremental-builds)
+- [composite builds](#composite-builds) for easier integration of WALA
+ into larger projects
+- [automated Travis CI testing on macOS](#travis-ci-macos)
+
+## Known Shortcomings
+
+The Gradle build system is not yet ready to replace Maven, due to a
+few [known shortcomings](https://github.com/liblit/WALA/milestone/1).
+Paramount among these is that [Gradle WALA builds do not yet package
+up Eclipse plug-ins / features in the proper
+manner](https://github.com/liblit/WALA/issues/6). I have [poked at
+this a
+bit](https://github.com/liblit/WALA/tree/gradle-artifact-publishing),
+but I simply do not understand Eclipse and/or OSGi well enough to get
+the job done. I welcome help from anyone with the right knowledge!
+
+Either Gradle or Maven can be used to build WALA from the command
+line. However, it was not possible to extend this dual-build-system
+support to Eclipse. Working with WALA in Eclipse *requires* [doing
+things the Gradle way](#eclipse). Fortunately, this is rather
+seamless; I see no reason why an Eclipse-using WALA developer should
+need to avoid this switch.
+
+As noted [below](#classpath-and-project-as-generated-files), Eclipse
+`.classpath` and `.project` files are now generated rather than being
+repository-tracked source files. However, a few Maven-run tests
+depend on having certain of these files present. One way to create
+them is to [import WALA into
+Eclipse](#importing-wala-projects-into-eclipse) before starting your
+Maven tests. If you prefer a non-interactive approach, you can
+instead run `./gradlew prepareMavenBuild` before starting your Maven
+tests.
+
+# Getting Started
+
+## External Dependencies: Patience is a Virtue
+
+Gradle downloads many packages and supporting Java libraries as
+needed. Your first Gradle build may take a long time. On a fast
+workstation with a University-grade network and no local caches, my
+initial run of `./gradlew assemble processTestResources` took five
+minutes. On a decent laptop with residential DSL and no local caches,
+the same initial build took twenty minutes. Fortunately, user- and
+project-level Gradle caches will make incremental rebuilds much
+faster. Rerunning `./gradlew assemble processTestResources` with a
+warm cache in an already-built tree takes under three seconds.
+
+Maven is the same, really. You may already have most of what Maven
+needs downloaded and cached locally, but your first Maven WALA build
+was probably slow as well. Recent Travis CI runs have showed Gradle
+and Maven builds completing in fifteen to twenty minutes, without
+significant variation between the two build systems.
+
+The good news is that the
+Gradle build knows about all of its external dependencies and will
+download them as needed. This even includes some complex dependencies
+that the Maven build does not automate. For example, the Gradle build
+will automatically gather required Android SDK components: setting
+`$ANDROID_HOME` is not needed. Gradle builds will also download
+`/tmp/DroidBench` when needed to run tests; the Maven build system
+required that each developer do this by hand.
+
+## Eclipse
+
+### One-Time Eclipse Configuration
+
+To work with WALA inside Eclipse, first **install Eclipse Buildship**
+using either [the Eclipse
+Marketplace](http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-marketplace)
+or [the Eclipse update
+manager](http://www.vogella.com/tutorials/EclipseGradle/article.html#installation-via-the-eclipse-update-manager).
+Buildship integrates Eclipse with Gradle, much like how M2Eclipse
+integrates Eclipse with Maven. Restart Eclipse after installing this
+feature.
+
+### Importing WALA Projects Into Eclipse
+
+Once you are running a Buildship-enabled Eclipse, **[use the “Existing
+Gradle Project” import
+wizard](http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project)
+to import WALA into Eclipse.** Select and import the topmost level of
+your WALA source tree. On the “Import Options” page of the import
+wizard, leave all settings at their defaults: the “Override workspace
+settings” option should be off, and the grayed-out “Gradle
+distribution” choice should be set to “Gradle wrapper”. You do not
+need to select each of WALA’s sub-projects; import only the top-level
+WALA source tree, and the rest will follow.
+
+After the lengthy import process completes, **use “Run → After
+Importing WALA Into Eclipse” to perform some post-import cleanup and
+configuration.** Immediately after importing, you may see some errors
+in the Eclipse “Problems” view. These should all go away after
+running the “After Importing WALA Into Eclipse” step.
+
+Note: a pristine WALA source tree is *not* pre-configured as a group
+of Eclipse projects. Using the standard Eclipse “Existing Projects
+into Workspace” import wizard will not work correctly. You must [use
+the “Existing Gradle Project” import
+wizard](http://www.vogella.com/tutorials/EclipseGradle/article.html#import-an-existing-gradle-project)
+instead.
+
+### `.classpath` and `.project` as Generated Files
+
+You will find no `.classpath` or `.project` files anywhere in [the
+Gradle fork of WALA’s git repository](https://github.com/liblit/WALA).
+Importing using the “Existing Gradle Project” wizard creates these
+Eclipse project configuration files automatically based on the
+underlying Gradle configuration.
+
+Therefore, when working with Eclipse + Gradle, you should **treat
+`.classpath` and `.project` files as *generated* artifacts,** not as
+files to edit directly or through the Eclipse project configuration
+GUI. For example, avoid using the Java Build Path settings dialog to
+make changes that are stored in a `.classpath` file: the modified
+`.classpath` file is not git-tracked, so your changes will eventually
+be lost or overwritten.
+
+The right way to change the contents of any of a `.classpath` or
+`.project` file is to change the Gradle configuration such that the
+generated `.classpath` and `.project` files will have the desired
+contents, likely by using [Gradle’s `eclipse`
+plugin](https://docs.gradle.org/current/userguide/eclipse_plugin.html).
+A few WALA sub-projects already use this: look for `eclipse.project`
+in `*/build.gradle` for examples.
+
+## IntelliJ IDEA
+
+### Opening WALA in IntelliJ IDEA
+
+WALA comes preconfigured as an openable IntelliJ IDEA project. Open
+the top-level WALA directory as a project; it should have a
+distinctive badge on its folder icon marking it as a directory
+containing a recognized IntelliJ IDEA project. Do *not* open the
+top-level WALA `build.gradle` in that directory as a project: this
+will begin an “Import Project from Gradle” process that is *not* the
+recommended way to bring WALA up in IntelliJ IDEA.
+
+The first time you open the WALA project, IntelliJ IDEA will
+synchronize its project model with the Gradle build configuration,
+including downloading some large supporting libraries. After the
+lengthy import process completes, **use “Run → Run… → After Opening
+Pristine Project” to perform some post-import configuration.** This
+also can take tens of minutes, but is only necessary in a clean,
+never-previously-built tree. Immediately after importing, you may see
+some Java compilation errors in the IntelliJ IDEA “Messages” view.
+These should all go away after running the “After Opening Pristine
+Project” step. [Be
+patient](#external-dependencies-patience-is-a-virtue) during the
+initial project open and also during the “After Opening Pristine
+Project” step, especially if you have a slow network connection.
+
+If you prefer a non-interactive approach, instead of using “After
+Opening Pristine Project” you can run `./gradlew prepareIntelliJIDEA`
+either before or after opening WALA in IntelliJ IDEA.
+
+### Benign Warning About Non-Managed Maven Project
+
+Each time you open the WALA project, IntelliJ IDEA may report
+“Non-managed pom.xml file found” in its event log. This arises
+because WALA supports both Gradle and Maven, but WALA in IntelliJ IDEA
+needs only the Gradle configuration. You can safely ignore this
+notification, permanently disable it using the offered “Disable
+notification” link, or even disable the IntelliJ IDEA Maven plugin
+entirely if you have no other need for it.
+
+### Project Configuration as Derived Model
+
+IntelliJ IDEA automatically derives its project models from the Gradle
+build configuration, including all information about both internal and
+external build dependencies. However, this synchronization only goes
+in one direction: from Gradle to IntelliJ IDEA, not from IntelliJ IDEA
+back into Gradle. If you manipulate the project structure using the
+IntelliJ IDEA’s user interface, your changes will likely be
+overwritten the next time IntelliJ IDEA scans the Gradle build
+configuration.
+
+This particularly applies to settings found in the “Modules” and
+“Libraries” sections of the “Project Structure” dialog. The right way
+to change module and library settings is to change the Gradle
+configuration such that the *derived* IntelliJ IDEA model is what you
+want it to be.
+
+## Gradle Command Line
+
+You do not need to install Gradle separately. **WALA includes its own
+copy of Gradle, available as the `gradlew` script in the top-level
+WALA directory.** Use this script for all command-line Gradle actions.
+For example, to compile all of WALA’s main (non-test) code and gather
+it into jar archives, run `./gradlew assemble`.
+
+In general, most Gradle-generated artifacts will appear somewhere
+under `*/build`. For example the jar archives created by the
+`assemble` task can be found as `*/build/libs/*.jar`. Note, however,
+that Eclipse-generated artifacts will still appear in the same places
+as before, such as `*/bin` and `*/target`.
+
+### Trustworthy Dependencies For Incremental Builds
+
+Gradle has excellent understanding of task and file dependencies. You
+can trust it to perform incremental rebuilds rather than always
+rebuilding from scratch. If you are used to always running `mvn clean
+compile` instead of `mvn compile`, or `mvn clean install` instead of
+`mvn install`, I recommend that you drop `clean` as a reflexive extra
+step and **trust Gradle to do incremental builds correctly.**
+
+### Favorite Build Tasks
+
+Some useful Gradle tasks include:
+
+- `assemble`: build WALA’s main (non-test) code
+
+- `build`: build all WALA code and run all automated tests
+
+- `javadoc`: build all Javadoc documentation
+
+- `publishToMavenLocal`: install WALA’s jar files under `~/.m2`
+
+- `clean`: remove all Gradle-generated artifacts
+
+### Tasks in Specific Sub-Projects
+
+When you run `./gradlew` in the top-level WALA directory, any tasks
+you list will be built in all sub-projects. For example, `./gradlew
+assemble` builds all non-test WALA jars in all sub-projects. If you
+want to build tasks only in specific sub-projects, you have two options:
+
+1. Give the fully-qualified name of the sub-project task. For
+ example, to assemble only the Dalvik jar, you could run `./gradlew
+ :com.ibm.wala.dalvik:assemble`.
+
+1. Run Gradle from within some sub-project directory. For example, to
+ assemble only the Dalvik jar, you could `cd com.ibm.wala.dalvik`
+ and then run `../gradlew assemble`. Note the proper relative path
+ to the top-level Gradle script: `../gradle` instead of `./gradlew`.
+
+### Task Name Abbreviation
+
+[Any build task can be
+abbreviated](https://docs.gradle.org/current/userguide/command_line_interface.html#_task_name_abbreviation)
+by shortening each camel-case-delimited word in its name. For
+example, the `processTestResources` task can probably be abbreviated
+as `procTeRes` or even `pTR`.
+
+### Useful Command-Line Flags
+
+Among Gradle’s command-line flags, I have found the following
+particularly useful:
+
+- [`--continue`](https://docs.gradle.org/current/userguide/command_line_interface.html#sec:continue_build_on_failure):
+ keep building non-dependent sub-tasks even after an initial failure.
+ Especially useful in conjunction with the `build` or `test` tasks to
+ see multiple test failures rather than giving up after the first
+ failure.
+
+- [`-t`,
+ `--continuous`](https://docs.gradle.org/current/userguide/command_line_interface.html#_continuous_build):
+ keep Gradle process running and re-execute the given tasks whenever
+ input files change. Similar to Eclipse’s behavior of updating the
+ build whenever you change and save a file.
+
+- [`--tests=...`](https://docs.gradle.org/current/userguide/java_plugin.html#test_filtering):
+ run only the selected tests. Use in conjunction with the `build` or
+ `test` tasks for faster turnaround if you are focusing on getting
+ just one or a few failing tests to pass.
+
+- [`--scan`](https://scans.gradle.com/): upload a detailed report of
+ the build process to a Gradle-hosted server for further exploration
+ and analysis. The only security here is the obscurity of the
+ generated URL for the build report. If you are not concerned about
+ potentially making your build details public, then `--scan` is a
+ good way to gain insights into why Gradle did what it did, and how
+ long each piece took.
+
+### Composite Builds
+
+Gradle’s [composite
+builds](https://docs.gradle.org/current/userguide/composite_builds.html)
+allow a Gradle-managed project to recursively include other
+Gradle-managed projects, with Gradle managing the entire build process
+in a coherent, integrated manner. Thus, if you use Gradle to build
+your WALA-based project, you can easily have it use WALA from your
+own, private WALA tree instead of from `~/.m2` or the public Maven
+repository.
+
+This is especially useful if you frequently find yourself switching
+between multiple different personal or experimental WALA builds. By
+avoiding `~/.m2`, each WALA-based project can be its own composite
+build, with its own WALA subtree, and no project interferes with any
+other.
+
+# Travis CI
+
+I use a [Travis CI build
+matrix](https://docs.travis-ci.com/user/customizing-the-build/#Build-Matrix)
+to perform automated testing in three configurations:
+
+1. Gradle build on Ubuntu 14 (Trusty Tahr)
+1. Maven build on Ubuntu 14 (Trusty Tahr)
+1. Gradle build on macOS 10.12 (Sierra)
+
+Until we are ready to completely replace Maven with Gradle, it is
+important that both keep working. Therefore, I use Travis CI to build
+and test WALA on Ubuntu using both Gradle and Maven. Every new pull
+request must be validated in both of these configurations before I
+will accept it onto the `gradle-and-buildship` branch.
+
+The official WALA repository has no macOS CI
+testing. However, [macOS is the main development platform for at
+least one WALA
+maintainer](https://github.com/liblit/WALA/issues/3#issuecomment-356823287),
+so it is great to have Travis CI helping us keep that platform
+working. I will not accept pull requests that introduce regressions
+into Gradle macOS builds. However, I am not using Travis CI to test
+Maven macOS builds. Initial attempts using [the official WALA master
+sources](https://github.com/wala/WALA) failed. As it is my goal to
+replace Maven entirely, investigating Maven+macOS failures further is
+not a priority.
+
+
diff --git a/build-maven-jars.py b/build-maven-jars.py
index 1e3752f6c..9d9c7dfd7 100755
--- a/build-maven-jars.py
+++ b/build-maven-jars.py
@@ -29,14 +29,14 @@ projects = [
for proj in projects:
full_proj = "com.ibm.wala." + proj
- print full_proj
+ print(full_proj)
os.chdir(full_proj)
mvnCmd = "mvn -f mvncentral.xml clean " + action
try:
subprocess.check_output(mvnCmd, shell=True)
except subprocess.CalledProcessError as e:
- print "OUTPUT"
- print e.output
+ print("OUTPUT")
+ print(e.output)
raise
os.chdir("..")
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 000000000..f9a7ea106
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,184 @@
+////////////////////////////////////////////////////////////////////////
+//
+// plugin configuration must precede everything else
+//
+
+plugins {
+ id 'com.diffplug.gradle.p2.asmaven' version '3.10.0'
+ id 'com.github.hauner.jarTest' version '1.0.1' apply false
+ id 'de.undercouch.download'
+ id 'nebula.lint' version '8.3.1'
+ id 'nebula.source-jar' version '7.0.1' apply false
+}
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// required Eclipse components
+//
+
+p2AsMaven {
+ group 'eclipse-deps', {
+ repoEclipse '4.7.2'
+ slicingOption 'latestVersionOnly', 'true'
+ iu 'org.eclipse.core.commands'
+ iu 'org.eclipse.core.contenttype'
+ iu 'org.eclipse.core.jobs'
+ iu 'org.eclipse.core.resources'
+ iu 'org.eclipse.core.runtime'
+ iu 'org.eclipse.equinox.app'
+ iu 'org.eclipse.equinox.common'
+ iu 'org.eclipse.equinox.preferences'
+ iu 'org.eclipse.jdt.core'
+ iu 'org.eclipse.jface'
+ iu 'org.eclipse.osgi'
+ iu 'org.eclipse.pde.core'
+ iu 'org.eclipse.swt'
+ iu 'org.eclipse.ui.ide'
+ iu 'org.eclipse.ui.workbench'
+ }
+ group 'wst-deps', {
+ repo 'http://download.eclipse.org/releases/oxygen'
+ slicingOption 'latestVersionOnly', 'true'
+ iu 'org.eclipse.wst.jsdt.core'
+ iu 'org.eclipse.wst.jsdt.ui'
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// common Java setup shared by multiple projects
+//
+
+group name
+version '1.5.1-SNAPSHOT'
+
+subprojects { subproject ->
+ // skip generic Java setup for the few projects that have no Java code whatsoever
+ switch (subproject.name) {
+ case 'com.ibm.wala-repository':
+ case ~/.*_feature/:
+ return
+ }
+
+ apply plugin: 'java'
+ apply plugin: 'maven-publish'
+ apply plugin: 'nebula.source-jar'
+
+ version rootProject.version
+
+ repositories {
+ mavenCentral()
+ maven {
+ url "$rootProject.buildDir/p2asmaven/maven"
+ }
+ }
+
+ jar.manifest.from('META-INF/MANIFEST.MF')
+
+ publishing.publications {
+ mavenJava(MavenPublication) {
+ from components.java
+ }
+ }
+
+ task afterEclipseBuildshipImport(dependsOn: processTestResources)
+ task prepareIntelliJIDEA
+
+ test {
+ include '**/*Test.class'
+ include '**/*TestCase.class'
+ include '**/*Tests.class'
+ include '**/Test*.class'
+ exclude '**/*AndroidLibs*.class'
+
+ maxParallelForks = Integer.MAX_VALUE
+ }
+}
+
+task afterEclipseBuildshipImport(type: Exec) {
+ commandLine './revert-launchers.sh'
+}
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// find platform-specific SWT implementations
+//
+
+def osgi_platform
+
+switch (System.getProperty('os.name')) {
+ case ~/Mac OS X/:
+ osgi_platform = 'cocoa.macosx.x86_64'
+ break
+ case ~/Windows.*/:
+ osgi_platform = 'win32.win32.x86_64'
+ break
+ case ~/Linux/:
+ osgi_platform = 'gtk.linux.x86_64'
+ break
+}
+
+System.setProperty('osgi.platform', osgi_platform)
+
+subprojects {
+ configurations.all {
+ resolutionStrategy {
+ // failOnVersionConflict()
+ dependencySubstitution {
+ substitute module('eclipse-deps:org.eclipse.swt.${osgi.platform}') with module("eclipse-deps:org.eclipse.swt.${System.getProperty('osgi.platform')}:3.+")
+ }
+ }
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// optional lint checking of Gradle scripts
+//
+
+allprojects {
+ apply plugin: 'nebula.lint'
+ gradleLint.alwaysRun = false
+ gradleLint {
+ rules = ['all-dependency']
+ excludedRules = [
+ 'duplicate-dependency-class',
+ 'transitive-duplicate-dependency-class',
+ 'unused-dependency',
+ ]
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// disable Javadoc linter until documentation is in better shape
+//
+
+allprojects {
+ tasks.withType(Javadoc) {
+ options.addStringOption('Xdoclint:none', '-quiet')
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// Eclipse IDE integration
+//
+
+// workaround for
+allprojects {
+ apply plugin: 'eclipse'
+
+ eclipse.classpath.file.whenMerged {
+ entries.each {
+ if (it in org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry && it.entryAttributes['gradle_used_by_scope'] == 'test')
+ it.entryAttributes['test'] = true
+ }
+ }
+}
diff --git a/buildSrc/.gitignore b/buildSrc/.gitignore
new file mode 100644
index 000000000..da88288c0
--- /dev/null
+++ b/buildSrc/.gitignore
@@ -0,0 +1 @@
+/.gradle/
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
new file mode 100644
index 000000000..9471c529c
--- /dev/null
+++ b/buildSrc/build.gradle
@@ -0,0 +1,7 @@
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ compile 'de.undercouch:gradle-download-task:3.4.3'
+}
diff --git a/buildSrc/src/main/groovy/package-list.groovy b/buildSrc/src/main/groovy/package-list.groovy
new file mode 100644
index 000000000..420eb95d6
--- /dev/null
+++ b/buildSrc/src/main/groovy/package-list.groovy
@@ -0,0 +1,31 @@
+import org.gradle.api.tasks.*
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// create a Javadoc-style "package-list" file
+//
+
+@CacheableTask
+class CreatePackageList extends org.gradle.api.DefaultTask {
+
+ @PathSensitive(PathSensitivity.RELATIVE)
+ @Input Object sourceSet
+
+ @OutputFile File packageList = new File("$temporaryDir/package-list")
+
+ @TaskAction
+ def create() {
+ sourceSet.sourceCollections.collect { collection ->
+ def sourceRoot = collection.tree.dir.toPath()
+ collection.collect { source ->
+ def javaSourceFilePath = source.toPath()
+ def parentPath = javaSourceFilePath.parent
+ def relativePath = sourceRoot.relativize(parentPath)
+ relativePath.toString().replace(File.separator, '.')
+ }
+ }.flatten().sort().unique().each {
+ packageList << "$it\n"
+ }
+ }
+}
diff --git a/buildSrc/src/main/groovy/verified-download.groovy b/buildSrc/src/main/groovy/verified-download.groovy
new file mode 100644
index 000000000..791c8b691
--- /dev/null
+++ b/buildSrc/src/main/groovy/verified-download.groovy
@@ -0,0 +1,53 @@
+import org.gradle.api.tasks.*
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// download and use checksum to verify that we got what we expected
+//
+
+@CacheableTask
+class VerifiedDownload extends org.gradle.api.DefaultTask {
+
+ // URL of resource to download
+ def @Input src
+
+ // expected checksum of resource as hex digits
+ def @Input checksum
+
+ // algorithm to use for computing checksum
+ def @Input algorithm = 'MD5'
+
+ // whether to use ETag for selective downloading
+ def @Input useETag = true
+
+ // local file into which resource should be saved
+ def @OutputFile dest
+
+ File getDest() {
+ return project.file(dest)
+ }
+
+ VerifiedDownload() {
+ outputs.upToDateWhen {
+ getDest().exists()
+ }
+ }
+
+ @TaskAction
+ downloadAndVerify() {
+ def destFile = getDest()
+ project.download {
+ src this.src
+ dest destFile
+ overwrite true
+ onlyIfModified true
+ useETag this.useETag
+ }
+ project.verifyChecksum {
+ src destFile
+ algorithm this.algorithm
+ checksum this.checksum
+ }
+ }
+}
diff --git a/change-version.py b/change-version.py
index 79a8235dc..b9d9098af 100755
--- a/change-version.py
+++ b/change-version.py
@@ -5,6 +5,10 @@
import sys
import subprocess
+def runAndPrint(cmd):
+ print cmd
+ subprocess.check_output(cmd, shell=True)
+
oldVersion = sys.argv[1]
newVersion = sys.argv[2]
@@ -13,13 +17,11 @@ print oldVersion + " --> " + newVersion
oldVersion = oldVersion.replace(".", "\.")
newVersion = newVersion.replace(".", "\.")
-cleanCmd = "mvn clean -q"
-print cleanCmd
-subprocess.check_output(cleanCmd, shell=True)
+runAndPrint("mvn clean -q")
-xmlCmd = "find -E ./ -regex \".*(pom|mvncentral)\.xml\" | xargs -n 1 perl -pi -e \'s/" + oldVersion + "/" + newVersion + "/g\'"
-print xmlCmd
-subprocess.check_output(xmlCmd, shell=True)
+runAndPrint("find -E ./ -regex \".*(pom|mvncentral)\.xml\" | xargs -n 1 perl -pi -e \'s/" + oldVersion + "/" + newVersion + "/g\'")
+
+runAndPrint("perl -pi -e \'s/" + oldVersion + "/" + newVersion + "/g\' build.gradle")
oldIsSnapshot = oldVersion.endswith("SNAPSHOT")
newIsSnapShot = newVersion.endswith("SNAPSHOT")
@@ -27,10 +29,7 @@ newIsSnapShot = newVersion.endswith("SNAPSHOT")
bundleOld = oldVersion if not oldIsSnapshot else oldVersion.replace("-SNAPSHOT","\.qualifier")
bundleNew = newVersion if not newIsSnapShot else newVersion.replace("-SNAPSHOT","\.qualifier")
-otherCmd = "find -E ./ -regex \".*(MANIFEST\.MF|feature\.xml)\" | xargs -n 1 perl -pi -e \'s/" + bundleOld + "/" + bundleNew + "/g\'"
-
-print otherCmd
-subprocess.check_output(otherCmd, shell=True)
+runAndPrint("find -E ./ -regex \".*(MANIFEST\.MF|feature\.xml)\" | xargs -n 1 perl -pi -e \'s/" + bundleOld + "/" + bundleNew + "/g\'")
print "done"
diff --git a/com.ibm.wala-repository/pom.xml b/com.ibm.wala-repository/pom.xml
index 69cba65f4..9a0886e63 100644
--- a/com.ibm.wala-repository/pom.xml
+++ b/com.ibm.wala-repository/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala-repository
eclipse-repository
diff --git a/com.ibm.wala.cast.java.ecj/.classpath b/com.ibm.wala.cast.java.ecj/.classpath
deleted file mode 100644
index eca7bdba8..000000000
--- a/com.ibm.wala.cast.java.ecj/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.java.ecj/.project b/com.ibm.wala.cast.java.ecj/.project
deleted file mode 100644
index d7049f923..000000000
--- a/com.ibm.wala.cast.java.ecj/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.java.ecj
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast.java.ecj/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.java.ecj/.settings/org.eclipse.jdt.core.prefs
index 201e24b39..42ad03810 100644
--- a/com.ibm.wala.cast.java.ecj/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.java.ecj/.settings/org.eclipse.jdt.core.prefs
@@ -9,8 +9,13 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
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
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error
diff --git a/com.ibm.wala.cast.java.ecj/META-INF/MANIFEST.MF b/com.ibm.wala.cast.java.ecj/META-INF/MANIFEST.MF
index 9e0c938c7..d97999ff5 100644
--- a/com.ibm.wala.cast.java.ecj/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.java.ecj/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.ecj
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: com.ibm.wala.cast.java,
diff --git a/com.ibm.wala.cast.java.ecj/build.gradle b/com.ibm.wala.cast.java.ecj/build.gradle
new file mode 100644
index 000000000..5aab2da58
--- /dev/null
+++ b/com.ibm.wala.cast.java.ecj/build.gradle
@@ -0,0 +1,15 @@
+sourceSets.main.java.srcDirs = ['src']
+
+dependencies {
+ compile(
+ 'eclipse-deps:org.eclipse.core.runtime:+',
+ 'eclipse-deps:org.eclipse.equinox.common:+',
+ 'eclipse-deps:org.eclipse.jdt.core:+',
+ 'org.osgi:org.osgi.core:4.2.0',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.cast.java'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.shrike'),
+ project(':com.ibm.wala.util'),
+ )
+}
diff --git a/com.ibm.wala.cast.java.ecj/mvncentral.xml b/com.ibm.wala.cast.java.ecj/mvncentral.xml
index 58a676b2a..fe7869292 100644
--- a/com.ibm.wala.cast.java.ecj/mvncentral.xml
+++ b/com.ibm.wala.cast.java.ecj/mvncentral.xml
@@ -5,7 +5,7 @@
4.0.0
com.ibm.wala
com.ibm.wala.cast.java.ecj
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
jar
WALA CAst Java ECJ
WALA Common AST Java ECJ front-end
@@ -45,27 +45,27 @@
com.ibm.wala
com.ibm.wala.util
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.cast
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.cast.java
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.core
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.shrike
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
org.eclipse.core
diff --git a/com.ibm.wala.cast.java.ecj/pom.xml b/com.ibm.wala.cast.java.ecj/pom.xml
index 79929ed01..1533b8716 100644
--- a/com.ibm.wala.cast.java.ecj/pom.xml
+++ b/com.ibm.wala.cast.java.ecj/pom.xml
@@ -5,7 +5,7 @@
WALA
com.ibm.wala
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.java.ecj
eclipse-plugin
diff --git a/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/JDT2CAstUtils.java b/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/JDT2CAstUtils.java
index 99288b5a6..36138e06b 100644
--- a/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/JDT2CAstUtils.java
+++ b/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/JDT2CAstUtils.java
@@ -188,7 +188,7 @@ public class JDT2CAstUtils {
*/
public static Object defaultValueForType(ITypeBinding type) {
if (isLongOrLess(type))
- return new Integer(0);
+ return Integer.valueOf(0);
else if (type.getBinaryName().equals("D") || type.getBinaryName().equals("F"))
return new Double(0.0);
else
diff --git a/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/JDTJava2CAstTranslator.java b/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/JDTJava2CAstTranslator.java
index b2b35353e..44fb0c268 100644
--- a/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/JDTJava2CAstTranslator.java
+++ b/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/JDTJava2CAstTranslator.java
@@ -274,7 +274,12 @@ public abstract class JDTJava2CAstTranslator {
protected final class ClassEntity implements CAstEntity {
// TAGALONG (not static, will keep reference to ast, fIdentityMapper, etc)
- private final String fName;
+ @Override
+ public Position getPosition(int arg) {
+ return null;
+ }
+
+ private final String fName;
private final Collection fQuals;
@@ -284,8 +289,11 @@ public abstract class JDTJava2CAstTranslator {
private final T fSourcePosition;
+ private final T fNamePos;
+
public ClassEntity(ITypeBinding jdtType, String name, Collection quals, Collection entities,
- T pos) {
+ T pos, T namePos) {
+ fNamePos = namePos;
fName = name;
fQuals = quals;
fEntities = entities;
@@ -391,6 +399,11 @@ public abstract class JDTJava2CAstTranslator {
return fTypeDict.new JdtJavaType(fJdtType);
}
+ @Override
+ public Position getNamePosition() {
+ return fNamePos;
+ }
+
}
private static boolean isInterface(AbstractTypeDeclaration decl) {
@@ -400,7 +413,7 @@ public abstract class JDTJava2CAstTranslator {
private CAstEntity visitTypeDecl(AbstractTypeDeclaration n, WalkContext context) {
return createClassDeclaration(n, n.bodyDeclarations(), null, n.resolveBinding(), n.getName().getIdentifier(), n.getModifiers(),
- isInterface(n), n instanceof AnnotationTypeDeclaration, context);
+ isInterface(n), n instanceof AnnotationTypeDeclaration, context, makePosition(n.getName()));
}
/**
@@ -411,10 +424,11 @@ public abstract class JDTJava2CAstTranslator {
* @param typeBinding
* @param name Used in creating default constructor, and passed into new ClassEntity()
* @param context
+ * @param namePos
*/
private CAstEntity createClassDeclaration(ASTNode n, List bodyDecls,
List enumConstants, ITypeBinding typeBinding, String name, int modifiers,
- boolean isInterface, boolean isAnnotation, WalkContext context) {
+ boolean isInterface, boolean isAnnotation, WalkContext context, T namePos) {
final List memberEntities = new ArrayList<>();
// find and collect all initializers (type Initializer) and field initializers (type VariableDeclarationFragment).
@@ -460,7 +474,7 @@ public abstract class JDTJava2CAstTranslator {
IVariableBinding fieldBinding = fieldFrag.resolveBinding();
memberEntities.add(new FieldEntity(fieldFrag.getName().getIdentifier(), fieldBinding.getType(), quals,
makePosition(fieldFrag.getStartPosition(), fieldFrag.getStartPosition() + fieldFrag.getLength()),
- handleAnnotations(fieldBinding)));
+ handleAnnotations(fieldBinding), makePosition(fieldFrag.getName())));
}
} else if (decl instanceof Initializer) {
// Initializers are inserted into constructors when making constructors.
@@ -521,12 +535,12 @@ public abstract class JDTJava2CAstTranslator {
Collection quals = JDT2CAstUtils.mapModifiersToQualifiers(modifiers, isInterface, isAnnotation);
- return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n));
+ return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n), namePos);
}
private CAstEntity visit(AnonymousClassDeclaration n, WalkContext context) {
return createClassDeclaration(n, n.bodyDeclarations(), null, n.resolveBinding(),
- JDT2CAstUtils.anonTypeName(n.resolveBinding()), 0 /* no modifiers */, false, false, context);
+ JDT2CAstUtils.anonTypeName(n.resolveBinding()), 0 /* no modifiers */, false, false, context, null);
}
private CAstNode visit(TypeDeclarationStatement n, WalkContext context) {
@@ -1031,7 +1045,13 @@ public abstract class JDTJava2CAstTranslator {
return new CAstType.Method() {
private Collection fExceptionTypes = null;
+
@Override
+ public boolean isStatic() {
+ return getQualifiers().contains(CAstQualifier.STATIC);
+ }
+
+ @Override
public CAstType getReturnType() {
if (fReturnType != null)
return fTypeDict.getCAstTypeFor(fReturnType);
@@ -1088,6 +1108,22 @@ public abstract class JDTJava2CAstTranslator {
}
};
}
+
+ @Override
+ public Position getPosition(int arg) {
+ // TODO Auto-generated method stub
+ SingleVariableDeclaration p = (SingleVariableDeclaration) fDecl.parameters().get(arg);
+ return makePosition(p);
+ }
+
+ @Override
+ public Position getNamePosition() {
+ if (fDecl == null) {
+ return null;
+ } else {
+ return makePosition(fDecl);
+ }
+ }
}
// ////////////////////////////////////
@@ -1140,13 +1176,16 @@ public abstract class JDTJava2CAstTranslator {
private final T position;
+ private final T namePos;
+
private final Set annotations;
- private FieldEntity(String name, ITypeBinding type, Collection quals, T position, Set annotations) {
+ private FieldEntity(String name, ITypeBinding type, Collection quals, T position, Set annotations, T namePos) {
super();
this.type = type;
this.quals = quals;
this.name = name;
+ this.namePos = namePos;
this.position = position;
this.annotations = annotations;
}
@@ -1239,6 +1278,19 @@ public abstract class JDTJava2CAstTranslator {
public CAstType getType() {
return fTypeDict.getCAstTypeFor(type);
}
+
+
+ @Override
+ public Position getPosition(int arg) {
+ return namePos;
+ }
+
+
+ @Override
+ public Position getNamePosition() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
// /////////////////////////////////////
@@ -2305,7 +2357,7 @@ public abstract class JDTJava2CAstTranslator {
private CAstNode getSwitchCaseConstant(SwitchCase n, WalkContext context) {
// TODO: enums
Expression expr = n.getExpression();
- Object constant = (expr == null) ? new Integer(0) : expr.resolveConstantExpressionValue(); // default case label of
+ Object constant = (expr == null) ? Integer.valueOf(0) : expr.resolveConstantExpressionValue(); // default case label of
// "0" (what polyglot
// does). we also set
// SWITCH_DEFAULT
@@ -2562,7 +2614,7 @@ public abstract class JDTJava2CAstTranslator {
/*------ indexDecl --------- int tmpindex = 0 ------*/
final String tmpIndexName = "for temp index";
CAstNode indexDeclNode = makeNode(context, fFactory, n, CAstNode.DECL_STMT, fFactory.makeConstant(new InternalCAstSymbol(
- tmpIndexName, fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("int")), true)), fFactory.makeConstant(new Integer(0)));
+ tmpIndexName, fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("int")), true)), fFactory.makeConstant(Integer.valueOf(0)));
/*------ cond ------------- tmpindex < tmparray.length ------*/
CAstNode tmpArrayLengthNode = makeNode(context, fFactory, n, CAstNode.ARRAY_LENGTH, makeNode(context, fFactory, n,
@@ -3016,6 +3068,16 @@ public abstract class JDTJava2CAstTranslator {
Assertions.UNREACHABLE("CompilationUnitEntity.getType()");
return null;
}
+
+ @Override
+ public Position getPosition(int arg) {
+ return null;
+ }
+
+ @Override
+ public Position getNamePosition() {
+ return null;
+ }
}
// /////////////////////////////
@@ -3311,7 +3373,7 @@ public abstract class JDTJava2CAstTranslator {
*/
private CAstEntity visit(EnumConstantDeclaration decl, WalkContext context) {
return new FieldEntity(decl.getName().getIdentifier(), decl.resolveVariable().getType(), enumQuals, makePosition(decl
- .getStartPosition(), decl.getStartPosition() + decl.getLength()), null);
+ .getStartPosition(), decl.getStartPosition() + decl.getLength()), null, makePosition(decl.getName()));
}
/**
@@ -3460,10 +3522,9 @@ public abstract class JDTJava2CAstTranslator {
}
private CAstEntity visit(EnumDeclaration n, WalkContext context) {
-
// JDT contains correct type info / class / subclass info for the enum
return createClassDeclaration(n, n.bodyDeclarations(), n.enumConstants(), n.resolveBinding(), n.getName().getIdentifier(), n
- .resolveBinding().getModifiers(), false, false, context);
+ .resolveBinding().getModifiers(), false, false, context, makePosition(n.getName()));
}
/**
diff --git a/com.ibm.wala.cast.java.test.data/.classpath b/com.ibm.wala.cast.java.test.data/.classpath
deleted file mode 100644
index 4f83b2397..000000000
--- a/com.ibm.wala.cast.java.test.data/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.java.test.data/.gitignore b/com.ibm.wala.cast.java.test.data/.gitignore
deleted file mode 100644
index 3a279a54f..000000000
--- a/com.ibm.wala.cast.java.test.data/.gitignore
+++ /dev/null
@@ -1,103 +0,0 @@
-/p
-/A.class
-/AnonymousClass.class
-/AnonymousClass.java
-/AnonymousClass$1.class
-/AnonymousClass$1FooImpl.class
-/AnonymousClass$2.class
-/AnonymousClass$Foo.class
-/Array1.class
-/Array1.java
-/ArrayLiteral1.class
-/ArrayLiteral1.java
-/ArrayLiteral2.class
-/ArrayLiteral2.java
-/B.class
-/BadLanguageExceptionEx1.class
-/BadLanguageExceptionF1.class
-/Bar.class
-/Base.class
-/Breaks.class
-/Breaks.java
-/Breaks$1.class
-/Breaks$Ref.class
-/CastFromNull.class
-/CastFromNull.java
-/Casts.class
-/Casts.java
-/Derived.class
-/Exception1.class
-/Exception1.java
-/Exception2.class
-/Exception2.java
-/Finally1.class
-/Finally1.java
-/FooEx1.class
-/FooEx2.class
-/FooF1.class
-/FooIT1.class
-/FooQ.class
-/IFoo.class
-/Inheritance1.class
-/Inheritance1.java
-/InheritedField.class
-/InheritedField.java
-/InnerClass.class
-/InnerClass.java
-/InnerClass$WhatsIt.class
-/InnerClass$WhatsIt$NotAgain.class
-/InnerClass$WhatsThat.class
-/InnerClassA.class
-/InnerClassA.java
-/InnerClassA$AA.class
-/InnerClassA$AB.class
-/InnerClassA$AB$ABA.class
-/InnerClassA$AB$ABA$ABAA.class
-/InnerClassA$AB$ABA$ABAB.class
-/InnerClassA$AB$ABSubA.class
-/InnerClassA$AB$ABSubA$ABSubAA.class
-/InnerClassSuper.class
-/InnerClassSuper.java
-/InnerClassSuper$SuperOuter.class
-/InterfaceTest1.class
-/InterfaceTest1.java
-/IntWrapper.class
-/LocalClass.class
-/LocalClass.java
-/LocalClass$1Foo.class
-/LocalClass$2Foo.class
-/MiniaturList.class
-/MiniaturList.java
-/MiniaturSliceBug.class
-/MiniaturSliceBug.java
-/Monitor.class
-/Monitor.java
-/NullArrayInit.class
-/NullArrayInit.java
-/PrimitiveWrapper.class
-/QualifiedStatic.class
-/QualifiedStatic.java
-/R.class
-/Scoping1.class
-/Scoping1.java
-/Scoping2.class
-/Scoping2.java
-/Scoping2$1.class
-/Simple1.class
-/Simple1.java
-/StaticInitializers.class
-/StaticInitializers.java
-/StaticInitializers$X.class
-/StaticNesting.class
-/StaticNesting.java
-/StaticNesting$WhatsIt.class
-/Sub.class
-/Sub$SubInner.class
-/Switch1.class
-/Switch1.java
-/Thread1.class
-/Thread1.java
-/TwoClasses.class
-/TwoClasses.java
-/WhileTest1.class
-/WhileTest1.java
diff --git a/com.ibm.wala.cast.java.test.data/.project b/com.ibm.wala.cast.java.test.data/.project
deleted file mode 100644
index 2c6efd271..000000000
--- a/com.ibm.wala.cast.java.test.data/.project
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
- com.ibm.wala.cast.java.test.data
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
- org.eclipse.ui.externaltools.ExternalToolBuilder
- full,incremental,
-
-
- LaunchConfigHandle
- <project>/.externalToolBuilders/java.test.data JLex download.launch
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.pde.PluginNature
-
-
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 af9c1751e..e9bbf5230 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
@@ -18,6 +18,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
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.APILeak=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -68,7 +69,7 @@ org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
@@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
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 d3559f6f8..342e75963 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
@@ -2,6 +2,6 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.test.data
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/com.ibm.wala.cast.java.test.data/build.gradle b/com.ibm.wala.cast.java.test.data/build.gradle
new file mode 100644
index 000000000..0752d30c5
--- /dev/null
+++ b/com.ibm.wala.cast.java.test.data/build.gradle
@@ -0,0 +1,35 @@
+plugins {
+ id 'eclipse'
+}
+
+sourceSets.test.java.srcDirs = ['src']
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// download JLex
+//
+
+task downloadJLex(type: VerifiedDownload) {
+ src 'http://www.cs.princeton.edu/~appel/modern/java/JLex/current/Main.java'
+ checksum 'fe0cff5db3e2f0f5d67a153cf6c783af'
+ dest 'src/JLex/Main.java'
+}
+
+task cleanDownloadJLex(type: Delete) {
+ delete downloadJLex.dest.parent
+}
+
+compileTestJava.dependsOn downloadJLex
+clean.dependsOn cleanDownloadJLex
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// create Eclipse metadata for use by Maven when running
+// com.ibm.wala.cast.java.test.JDTJavaIRTests and
+// com.ibm.wala.cast.java.test.JDTJava15IRTests tests
+//
+
+task prepareMavenBuild(dependsOn: [eclipseClasspath, eclipseProject]) {
+}
diff --git a/com.ibm.wala.cast.java.test.data/pom.xml b/com.ibm.wala.cast.java.test.data/pom.xml
index 708724231..39fb098a9 100644
--- a/com.ibm.wala.cast.java.test.data/pom.xml
+++ b/com.ibm.wala.cast.java.test.data/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.java.test.data
eclipse-plugin
diff --git a/com.ibm.wala.cast.java.test.data/src/AnonymousClass.java b/com.ibm.wala.cast.java.test.data/src/AnonymousClass.java
index 92e015991..fa8f2eb72 100644
--- a/com.ibm.wala.cast.java.test.data/src/AnonymousClass.java
+++ b/com.ibm.wala.cast.java.test.data/src/AnonymousClass.java
@@ -15,7 +15,7 @@ public class AnonymousClass {
}
public static void main(String[] args) {
- final Integer base = new Integer(6);
+ final Integer base = Integer.valueOf(6);
Foo f= new Foo() {
int value = 3;
@@ -34,7 +34,7 @@ public class AnonymousClass {
}
public void method() {
- final Integer base = new Integer(7);
+ final Integer base = Integer.valueOf(7);
abstract class FooImpl implements Foo {
int y;
diff --git a/com.ibm.wala.cast.java.test.data/src/ArrayLiteral1.java b/com.ibm.wala.cast.java.test.data/src/ArrayLiteral1.java
index f0f2ea9f0..3b6f2a776 100644
--- a/com.ibm.wala.cast.java.test.data/src/ArrayLiteral1.java
+++ b/com.ibm.wala.cast.java.test.data/src/ArrayLiteral1.java
@@ -12,6 +12,6 @@ public class ArrayLiteral1 {
public static void main(String[] args) {
ArrayLiteral1 al1= new ArrayLiteral1();
int[] a= new int[] { 0, 1, 2, 3, 5 };
- Object[] b= new Object[] { null, "hi", new Integer(55), new int[] { 3, 1, 4 } };
+ Object[] b= new Object[] { null, "hi", Integer.valueOf(55), new int[] { 3, 1, 4 } };
}
}
diff --git a/com.ibm.wala.cast.java.test.data/src/LocalClass.java b/com.ibm.wala.cast.java.test.data/src/LocalClass.java
index 5b622f763..d54ca13bf 100644
--- a/com.ibm.wala.cast.java.test.data/src/LocalClass.java
+++ b/com.ibm.wala.cast.java.test.data/src/LocalClass.java
@@ -10,7 +10,7 @@
*****************************************************************************/
public class LocalClass {
public static void main(String[] args) {
- final Integer base = new Integer(6);
+ final Integer base = Integer.valueOf(6);
class Foo {
int value;
@@ -27,7 +27,7 @@ public class LocalClass {
}
public void method() {
- final Integer base = new Integer(6);
+ final Integer base = Integer.valueOf(6);
class Foo {
int value;
diff --git a/com.ibm.wala.cast.java.test.data/src/foo/bar/hello/world/ArraysAndSuch.java b/com.ibm.wala.cast.java.test.data/src/foo/bar/hello/world/ArraysAndSuch.java
index 21bb0c585..d212743e9 100644
--- a/com.ibm.wala.cast.java.test.data/src/foo/bar/hello/world/ArraysAndSuch.java
+++ b/com.ibm.wala.cast.java.test.data/src/foo/bar/hello/world/ArraysAndSuch.java
@@ -42,7 +42,6 @@ public class ArraysAndSuch {
public static void main(String args[]) {
ArraysAndSuch.main();
}
- @SuppressWarnings("null")
public static void main() {
Object o1 = null;
Object[] os1 = new Object[] { null, o1, null };
diff --git a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/BasicsGenerics.java b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/BasicsGenerics.java
index 252ff67ad..58bc67db6 100644
--- a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/BasicsGenerics.java
+++ b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/BasicsGenerics.java
@@ -64,7 +64,7 @@ public class BasicsGenerics {
System.out.println(frenchy);
System.out.println(sicilian);
strs.add("hello");
- ints.add(new Integer(3));
+ ints.add(Integer.valueOf(3));
String qqq;
diff --git a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/ExplicitBoxingTest.java b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/ExplicitBoxingTest.java
index e3d807eb1..8dabe6e2b 100644
--- a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/ExplicitBoxingTest.java
+++ b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/ExplicitBoxingTest.java
@@ -47,8 +47,8 @@ public class ExplicitBoxingTest {
int a = 6;
a = a + a;
System.out.println(a);
- Integer useless1 = new Integer(5+6);
- Integer aa = new Integer(a+a);
+ Integer useless1 = Integer.valueOf(5+6);
+ Integer aa = Integer.valueOf(a+a);
int aaa = aa.intValue();
System.out.println(aaa);
diff --git a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/GenericArrays.java b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/GenericArrays.java
index 02abb9175..25c24b621 100644
--- a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/GenericArrays.java
+++ b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/GenericArrays.java
@@ -50,7 +50,7 @@ public class GenericArrays {
Object o = lsa;
Object[] oa = (Object[]) o;
List li = new ArrayList<>();
- li.add(new Integer(3));
+ li.add(Integer.valueOf(3));
oa[1] = li; // correct
String s = (String) lsa[1].get(0); // run time error, but cast is explicit
diff --git a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/MoreOverriddenGenerics.java b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/MoreOverriddenGenerics.java
index c9116deba..a2dc2a97d 100644
--- a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/MoreOverriddenGenerics.java
+++ b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/MoreOverriddenGenerics.java
@@ -58,7 +58,7 @@ public class MoreOverriddenGenerics {
@Override
public Long get() {
- return new Long(6);
+ return Long.valueOf(6);
}
}
diff --git a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/OverridesOnePointFour.java b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/OverridesOnePointFour.java
index c708122be..f62df4775 100644
--- a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/OverridesOnePointFour.java
+++ b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/OverridesOnePointFour.java
@@ -46,7 +46,7 @@ public class OverridesOnePointFour {
@Override
public Long get() {
- return new Long(6);
+ return Long.valueOf(6);
}
}
diff --git a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/Wildcards.java b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/Wildcards.java
index 285485966..15ced11c7 100644
--- a/com.ibm.wala.cast.java.test.data/src/javaonepointfive/Wildcards.java
+++ b/com.ibm.wala.cast.java.test.data/src/javaonepointfive/Wildcards.java
@@ -72,8 +72,8 @@ public class Wildcards {
printCollection2(e);
ArrayList e3 = new ArrayList<>();
- e3.add(new Integer(123));
- e3.add(new Integer(42));
+ e3.add(Integer.valueOf(123));
+ e3.add(Integer.valueOf(42));
printCollection(e3);
printCollection1(e3);
diff --git a/com.ibm.wala.cast.java.test/.classpath b/com.ibm.wala.cast.java.test/.classpath
deleted file mode 100644
index 4f83b2397..000000000
--- a/com.ibm.wala.cast.java.test/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.java.test/.cvsignore b/com.ibm.wala.cast.java.test/.cvsignore
deleted file mode 100644
index 23f0c70e0..000000000
--- a/com.ibm.wala.cast.java.test/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-domo-trace.txt*
diff --git a/com.ibm.wala.cast.java.test/.project b/com.ibm.wala.cast.java.test/.project
deleted file mode 100644
index ab02197e1..000000000
--- a/com.ibm.wala.cast.java.test/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.java.test
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast.java.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.java.test/.settings/org.eclipse.jdt.core.prefs
index 4aedc64f8..0c52ae802 100644
--- a/com.ibm.wala.cast.java.test/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.java.test/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/com.ibm.wala.cast.java.test/META-INF/MANIFEST.MF b/com.ibm.wala.cast.java.test/META-INF/MANIFEST.MF
index f42a6a393..fbe7c5ea7 100644
--- a/com.ibm.wala.cast.java.test/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.java.test/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.test
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Activator: com.ibm.wala.cast.java.test.TestPlugin
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.core.tests,
diff --git a/com.ibm.wala.cast.java.test/build.gradle b/com.ibm.wala.cast.java.test/build.gradle
new file mode 100644
index 000000000..9b23ffe33
--- /dev/null
+++ b/com.ibm.wala.cast.java.test/build.gradle
@@ -0,0 +1,25 @@
+plugins {
+ id 'com.github.hauner.jarTest'
+ id 'eclipse'
+}
+
+eclipse.project.natures 'org.eclipse.pde.PluginNature'
+
+sourceSets.test.java.srcDirs = ['src']
+
+dependencies {
+ testCompile(
+ 'junit:junit:4.12',
+ 'org.osgi:org.osgi.core:4.2.0',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.cast.java'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.shrike'),
+ project(':com.ibm.wala.util'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.core.tests'),
+ )
+}
+
+test {
+ maxHeapSize = '800M'
+}
diff --git a/com.ibm.wala.cast.java.test/build.properties b/com.ibm.wala.cast.java.test/build.properties
index 6138c1ade..142043f98 100644
--- a/com.ibm.wala.cast.java.test/build.properties
+++ b/com.ibm.wala.cast.java.test/build.properties
@@ -1,7 +1,6 @@
source.. = src/
-output.. = bin/
+output.. = bin/test
bin.includes = META-INF/,\
.,\
- OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true
diff --git a/com.ibm.wala.cast.java.test/pom.xml b/com.ibm.wala.cast.java.test/pom.xml
index dc6175f4a..bc96c0c75 100644
--- a/com.ibm.wala.cast.java.test/pom.xml
+++ b/com.ibm.wala.cast.java.test/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.java.test
eclipse-plugin
@@ -35,7 +35,7 @@
junit
junit
- 4.11
+ 4.12
test
diff --git a/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/IRTests.java b/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/IRTests.java
index 8d4c12923..95b9b5bb7 100644
--- a/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/IRTests.java
+++ b/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/IRTests.java
@@ -40,6 +40,7 @@ import com.ibm.wala.classLoader.SourceFileModule;
import com.ibm.wala.client.AbstractAnalysisEngine;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
+import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.cha.IClassHierarchy;
@@ -345,11 +346,11 @@ public abstract class IRTests {
return new String[] { "L" + pkgName + "/" + getTestName().substring(4) };
}
- protected abstract AbstractAnalysisEngine getAnalysisEngine(String[] mainClassDescriptors, Collection sources, List libs);
+ protected abstract AbstractAnalysisEngine, ?> getAnalysisEngine(String[] mainClassDescriptors, Collection sources, List libs);
- public Pair> runTest(Collection sources, List libs,
+ public Pair> runTest(Collection sources, List libs,
String[] mainClassDescriptors, List extends IRAssertion> ca, boolean assertReachable) throws IllegalArgumentException, CancelException, IOException {
- AbstractAnalysisEngine engine = getAnalysisEngine(mainClassDescriptors, sources, libs);
+ AbstractAnalysisEngine, ?> engine = getAnalysisEngine(mainClassDescriptors, sources, libs);
CallGraph callGraph;
callGraph = engine.buildDefaultCallGraph();
diff --git a/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/JavaIRTests.java b/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/JavaIRTests.java
index 4b3681583..1a4b546fa 100644
--- a/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/JavaIRTests.java
+++ b/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/JavaIRTests.java
@@ -318,13 +318,13 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testInnerClassA() throws IllegalArgumentException, CancelException, IOException {
- Pair> x =
+ Pair> x =
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList(), true);
// can't do an IRAssertion() -- we need the pointer analysis
CallGraph cg = x.fst;
- PointerAnalysis pa = x.snd;
+ PointerAnalysis extends InstanceKey> pa = x.snd;
Iterator iter = cg.iterator();
while ( iter.hasNext() ) {
@@ -377,13 +377,13 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testInnerClassSuper() throws IllegalArgumentException, CancelException, IOException {
- Pair> x =
+ Pair> x =
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList(), true);
// can't do an IRAssertion() -- we need the pointer analysis
CallGraph cg = x.fst;
- PointerAnalysis pa = x.snd;
+ PointerAnalysis extends InstanceKey> pa = x.snd;
Iterator iter = cg.iterator();
while ( iter.hasNext() ) {
@@ -534,15 +534,15 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testMiniaturSliceBug() throws IllegalArgumentException, CancelException, IOException {
- Pair> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
+ Pair> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
- PointerAnalysis pa = x.snd;
+ PointerAnalysis extends InstanceKey> pa = x.snd;
CallGraph cg = x.fst;
// test partial slice
MethodReference sliceRootRef = getSliceRootReference("MiniaturSliceBug", "validNonDispatchedCall", "(LIntWrapper;)V");
Set roots = cg.getNodes(sliceRootRef);
- Pair,SDG> y = AstJavaSlicer.computeAssertionSlice(cg, pa, roots, false);
+ Pair,SDG extends InstanceKey>> y = AstJavaSlicer.computeAssertionSlice(cg, pa, roots, false);
Collection slice = y.fst;
SlicerTest.dumpSlice(slice);
Assert.assertEquals(0, SlicerTest.countAllocations(slice));
diff --git a/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/SyncDuplicatorTests.java b/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/SyncDuplicatorTests.java
index e279545f4..50de1501b 100644
--- a/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/SyncDuplicatorTests.java
+++ b/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/SyncDuplicatorTests.java
@@ -40,7 +40,7 @@ public abstract class SyncDuplicatorTests extends IRTests {
Descriptor.findOrCreateUTF8(Language.JAVA, "(Ljava/lang/Object;)Z")), IInvokeInstruction.Dispatch.STATIC);
@Test public void testMonitor2() throws IllegalArgumentException, CancelException, IOException {
- Pair> result = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
+ Pair> result = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
System.err.println(result.fst);
}
diff --git a/com.ibm.wala.cast.java/.classpath b/com.ibm.wala.cast.java/.classpath
deleted file mode 100644
index 4f83b2397..000000000
--- a/com.ibm.wala.cast.java/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.java/.cvsignore b/com.ibm.wala.cast.java/.cvsignore
deleted file mode 100644
index 23f0c70e0..000000000
--- a/com.ibm.wala.cast.java/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-domo-trace.txt*
diff --git a/com.ibm.wala.cast.java/.project b/com.ibm.wala.cast.java/.project
deleted file mode 100644
index 335e71eda..000000000
--- a/com.ibm.wala.cast.java/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.java
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast.java/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.java/.settings/org.eclipse.jdt.core.prefs
index dbfe9d595..169bc4376 100644
--- a/com.ibm.wala.cast.java/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.java/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
@@ -17,6 +18,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
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.APILeak=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error
@@ -77,7 +79,7 @@ org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariable
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
@@ -90,6 +92,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
diff --git a/com.ibm.wala.cast.java/META-INF/MANIFEST.MF b/com.ibm.wala.cast.java/META-INF/MANIFEST.MF
index 97000fb92..f4c56e9ca 100644
--- a/com.ibm.wala.cast.java/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.java/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.cast,
com.ibm.wala.core,
@@ -21,3 +21,4 @@ Export-Package: com.ibm.wala.cast.java.analysis.typeInference,
com.ibm.wala.cast.java.types
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Automatic-Module-Name: com.ibm.wala.cast.java
diff --git a/com.ibm.wala.cast.java/build.gradle b/com.ibm.wala.cast.java/build.gradle
new file mode 100644
index 000000000..da8e92d0f
--- /dev/null
+++ b/com.ibm.wala.cast.java/build.gradle
@@ -0,0 +1,16 @@
+plugins {
+ id 'eclipse'
+}
+
+eclipse.project.natures 'org.eclipse.pde.PluginNature'
+
+sourceSets.main.java.srcDirs = ['src']
+
+dependencies {
+ compile(
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.shrike'),
+ project(':com.ibm.wala.util'),
+ )
+}
diff --git a/com.ibm.wala.cast.java/build.properties b/com.ibm.wala.cast.java/build.properties
index 6138c1ade..34e5e723d 100644
--- a/com.ibm.wala.cast.java/build.properties
+++ b/com.ibm.wala.cast.java/build.properties
@@ -1,5 +1,5 @@
source.. = src/
-output.. = bin/
+output.. = bin/main
bin.includes = META-INF/,\
.,\
OSGI-INF/l10n/bundle.properties,\
diff --git a/com.ibm.wala.cast.java/mvncentral.xml b/com.ibm.wala.cast.java/mvncentral.xml
index 84b6967f4..2ff8405e8 100644
--- a/com.ibm.wala.cast.java/mvncentral.xml
+++ b/com.ibm.wala.cast.java/mvncentral.xml
@@ -5,7 +5,7 @@
4.0.0
com.ibm.wala
com.ibm.wala.cast.java
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
jar
WALA CAst
WALA Common AST core Java front-end functionality
@@ -45,22 +45,22 @@
com.ibm.wala
com.ibm.wala.util
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.cast
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.core
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.shrike
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
diff --git a/com.ibm.wala.cast.java/pom.xml b/com.ibm.wala.cast.java/pom.xml
index 3a9a8a9f0..f138e08b8 100644
--- a/com.ibm.wala.cast.java/pom.xml
+++ b/com.ibm.wala.cast.java/pom.xml
@@ -5,7 +5,7 @@
WALA
com.ibm.wala
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.java
eclipse-plugin
diff --git a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/client/JavaSourceAnalysisEngine.java b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/client/JavaSourceAnalysisEngine.java
index 97fc1f4a3..849b97451 100644
--- a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/client/JavaSourceAnalysisEngine.java
+++ b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/client/JavaSourceAnalysisEngine.java
@@ -43,7 +43,7 @@ import com.ibm.wala.util.io.FileProvider;
/**
*/
-public abstract class JavaSourceAnalysisEngine extends AbstractAnalysisEngine {
+public abstract class JavaSourceAnalysisEngine extends AbstractAnalysisEngine, Void> {
/**
* Modules which are user-space code
@@ -167,7 +167,7 @@ public abstract class JavaSourceAnalysisEngine extends Ab
}
@Override
- protected CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
+ protected CallGraphBuilder super I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make(options, cache, cha, scope);
}
}
diff --git a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/client/impl/ZeroCFABuilderFactory.java b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/client/impl/ZeroCFABuilderFactory.java
index 5f423b413..903041ba9 100644
--- a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/client/impl/ZeroCFABuilderFactory.java
+++ b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/client/impl/ZeroCFABuilderFactory.java
@@ -16,6 +16,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.impl.Util;
+import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
import com.ibm.wala.ipa.cha.IClassHierarchy;
@@ -26,7 +27,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/
public class ZeroCFABuilderFactory {
- public CallGraphBuilder make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) {
+ public CallGraphBuilder make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) {
Util.addDefaultSelectors(options, cha);
Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
return new AstJavaZeroXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.NONE);
diff --git a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/callgraph/AstJavaSSAPropagationCallGraphBuilder.java b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/callgraph/AstJavaSSAPropagationCallGraphBuilder.java
index f868e3a12..7230b4539 100644
--- a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/callgraph/AstJavaSSAPropagationCallGraphBuilder.java
+++ b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/callgraph/AstJavaSSAPropagationCallGraphBuilder.java
@@ -256,7 +256,7 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
System.err.println(("class is " + klass + ", enclosing is " + enclosingClass + ", method is " + node.getMethod()));
- if (node.getMethod().isSynthetic()) {
+ if (node.getMethod().isWalaSynthetic()) {
return;
}
diff --git a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/slicer/AstJavaSlicer.java b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/slicer/AstJavaSlicer.java
index 9bc35a825..66d7d233a 100644
--- a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/slicer/AstJavaSlicer.java
+++ b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/slicer/AstJavaSlicer.java
@@ -89,10 +89,10 @@ public class AstJavaSlicer extends Slicer {
return gatherStatements(CG, partialRoots, o -> (o instanceof SSAGetInstruction) || (o instanceof SSAArrayLoadInstruction));
}
- public static Pair, SDG> computeAssertionSlice(CallGraph CG, PointerAnalysis pa,
+ public static Pair, SDG extends InstanceKey>> computeAssertionSlice(CallGraph CG, PointerAnalysis extends InstanceKey> pa,
Collection partialRoots, boolean multiThreadedCode) throws IllegalArgumentException, CancelException {
CallGraph pcg = PartialCallGraph.make(CG, new LinkedHashSet<>(partialRoots));
- SDG sdg = new SDG<>(pcg, pa, new AstJavaModRef<>(), DataDependenceOptions.FULL, ControlDependenceOptions.FULL);
+ SDG extends InstanceKey> sdg = new SDG<>(pcg, pa, new AstJavaModRef<>(), DataDependenceOptions.FULL, ControlDependenceOptions.FULL);
//System.err.println(("SDG:\n" + sdg));
Set stmts = gatherAssertions(CG, partialRoots);
if (multiThreadedCode) {
diff --git a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java
index 2b5171b08..a92a057e9 100644
--- a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java
+++ b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java
@@ -30,6 +30,9 @@ 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.AstPropertyRead;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
+import com.ibm.wala.cast.ir.ssa.AstYieldInstruction;
import com.ibm.wala.cast.ir.translator.AstTranslator;
import com.ibm.wala.cast.ir.translator.AstTranslator.AstLexicalInformation;
import com.ibm.wala.cast.java.ssa.AstJavaInstructionFactory;
@@ -91,7 +94,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/**
* WALA representation of a Java class residing in a source file
- *
+ *
* @author rfuhrer
*/
public class JavaClass extends AstClass {
@@ -100,7 +103,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
protected final Collection superTypeNames;
private final Collection annotations;
-
+
public JavaClass(String typeName, Collection superTypeNames, CAstSourcePositionMap.Position position, Collection qualifiers,
JavaSourceLoaderImpl loader, IClass enclosingClass, Collection annotations) {
super(position, TypeName.string2TypeName(typeName), loader, (short) mapToInt(qualifiers), new HashMap(), new HashMap());
@@ -141,11 +144,11 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/** END Custom change: Common superclass is optional */
Assertions.UNREACHABLE("Cannot find super class for " + this + " in " + superTypeNames);
}
-
+
if (excludedSupertype){
System.err.println("Not tracking calls through excluded superclass of " + getName() + " extends " + superTypeNames);
}
-
+
return null;
}
@@ -165,17 +168,17 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
return result;
}
- private void addMethod(CAstEntity methodEntity, IClass owner, AbstractCFG, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
+ protected void addMethod(CAstEntity methodEntity, IClass owner, AbstractCFG, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
Map, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
declaredMethods.put(Util.methodEntityToSelector(methodEntity), new ConcreteJavaMethod(methodEntity, owner, cfg, symtab,
hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo));
}
- private void addMethod(CAstEntity methodEntity, IClass owner) {
+ protected void addMethod(CAstEntity methodEntity, IClass owner) {
declaredMethods.put(Util.methodEntityToSelector(methodEntity), new AbstractJavaMethod(methodEntity, owner));
}
- private void addField(CAstEntity fieldEntity) {
+ protected void addField(CAstEntity fieldEntity) {
declaredFields.put(Util.fieldEntityToAtom(fieldEntity), new JavaField(fieldEntity, JavaSourceLoaderImpl.this, this, JavaSourceLoaderImpl.this.getAnnotations(fieldEntity)));
}
@@ -199,7 +202,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
}
}
- private Collection getAnnotations(CAstEntity e) {
+ protected Collection getAnnotations(CAstEntity e) {
Collection annotations = e.getAnnotations();
if (annotations == null || annotations.isEmpty()) {
return null;
@@ -221,14 +224,14 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
return result;
}
}
-
+
/**
* WALA representation of a field on a Java type that resides in a source file
- *
+ *
* @author rfuhrer
*/
- private class JavaField extends AstField {
- private JavaField(CAstEntity fieldEntity, IClassLoader loader, IClass declaringClass, Collection annotations) {
+ protected class JavaField extends AstField {
+ protected JavaField(CAstEntity fieldEntity, IClassLoader loader, IClass declaringClass, Collection annotations) {
super(FieldReference.findOrCreate(declaringClass.getReference(), Atom.findOrCreateUnicodeAtom(fieldEntity.getName()),
TypeReference.findOrCreate(loader.getReference(), TypeName.string2TypeName(fieldEntity.getType().getName()))),
fieldEntity.getQualifiers(), declaringClass, declaringClass.getClassHierarchy(), annotations);
@@ -238,10 +241,10 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/**
* Generic DOMO representation of a method on a Java type that resides in a
* source file
- *
+ *
* @author rfuhrer
*/
- private abstract class JavaEntityMethod extends AstMethod {
+ protected abstract class JavaEntityMethod extends AstMethod {
private final TypeReference[] parameterTypes;
private final TypeReference[] exceptionTypes;
@@ -276,7 +279,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
return parameterTypes[i];
}
- private TypeReference[] computeParameterTypes(CAstEntity methodEntity) {
+ protected TypeReference[] computeParameterTypes(CAstEntity methodEntity) {
TypeReference[] types;
CAstType.Function type = (Function) methodEntity.getType();
int argCount = type.getArgumentTypes().size();
@@ -303,7 +306,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
return exceptionTypes;
}
- private TypeReference[] computeExceptionTypes(CAstEntity methodEntity) {
+ protected TypeReference[] computeExceptionTypes(CAstEntity methodEntity) {
CAstType.Function fType = (Function) methodEntity.getType();
Collection exceptionTypes = fType.getExceptionTypes();
@@ -326,10 +329,10 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/**
* DOMO representation of an abstract (body-less) method on a Java type that
* resides in a source file
- *
+ *
* @author rfuhrer
*/
- private class AbstractJavaMethod extends JavaEntityMethod {
+ protected class AbstractJavaMethod extends JavaEntityMethod {
public AbstractJavaMethod(CAstEntity methodEntity, IClass owner) {
super(methodEntity, owner);
}
@@ -360,7 +363,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/**
* DOMO representation of a concrete method (which has a body) on a Java type
* that resides in a source file
- *
+ *
* @author rfuhrer
*/
public class ConcreteJavaMethod extends JavaEntityMethod {
@@ -483,7 +486,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
super(loaderRef, cha.getScope().getArrayClassLoader(), parent, cha.getScope().getExclusions(), cha);
this.existsCommonSuperclass = existsCommonSuperClass;
}
-
+
public JavaSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha) {
// standard case: we have a common super class
this(true, loaderRef, parent, cha);
@@ -503,7 +506,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/** BEGIN Custom change: Optional deletion of fTypeMap */
public static volatile boolean deleteTypeMapAfterInit = true;
/** END Custom change: Optional deletion of fTypeMap */
-
+
@Override
public void init(List modules) throws IOException {
@@ -528,10 +531,10 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
((JavaClass) owner).addField(n);
}
- private static TypeName toWALATypeName(CAstType type) {
+ protected static TypeName toWALATypeName(CAstType type) {
return TypeName.string2TypeName(type.getName());
}
-
+
public IClass defineType(CAstEntity type, String typeName, CAstEntity owner) {
Collection superTypeNames = new ArrayList<>();
for (CAstType superType : type.getType().getSupertypes()) {
@@ -544,7 +547,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
if (getParent().lookupClass(javaClass.getName()) != null) {
return null;
}
-
+
fTypeMap.put(type, javaClass);
loadedClasses.put(javaClass.getName(), javaClass);
return javaClass;
@@ -554,7 +557,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
public String toString() {
return "Java Source Loader (classes " + loadedClasses.values() + ")";
}
-
+
public static class InstructionFactory extends JavaInstructionFactory implements AstJavaInstructionFactory {
@Override
@@ -657,10 +660,27 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
public AstLexicalWrite LexicalWrite(int iindex, String definer, String globalName, TypeReference type, int rhs) {
return new AstLexicalWrite(iindex, definer, globalName, type, rhs);
}
+
+ @Override
+ public AstYieldInstruction YieldInstruction(int iindex, int[] rvals) {
+ return new AstYieldInstruction(iindex, rvals);
+ }
+
+ @Override
+ public AstPropertyRead PropertyRead(int iindex, int result, int objectRef, int memberRef) {
+ assert false;
+ return null;
+ }
+
+ @Override
+ public AstPropertyWrite PropertyWrite(int iindex, int objectRef, int memberRef, int value) {
+ assert false;
+ return null;
+ }
}
-
- private static final InstructionFactory insts = new InstructionFactory();
-
+
+ protected static final InstructionFactory insts = new InstructionFactory();
+
@Override
public InstructionFactory getInstructionFactory() {
return insts;
diff --git a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/translator/JavaCAst2IRTranslator.java b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/translator/JavaCAst2IRTranslator.java
index 1ab4c33ab..009b2e5ef 100644
--- a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/translator/JavaCAst2IRTranslator.java
+++ b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/translator/JavaCAst2IRTranslator.java
@@ -27,6 +27,7 @@ import com.ibm.wala.cast.tree.CAstControlFlowMap;
import com.ibm.wala.cast.tree.CAstEntity;
import com.ibm.wala.cast.tree.CAstNode;
import com.ibm.wala.cast.tree.CAstQualifier;
+import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
import com.ibm.wala.cast.tree.CAstType;
import com.ibm.wala.cast.tree.CAstType.Method;
import com.ibm.wala.cast.tree.visit.CAstVisitor;
@@ -436,6 +437,16 @@ public class JavaCAst2IRTranslator extends AstTranslator {
return getType("java.lang.Exception");
}
-
-
+ @Override
+ protected Position[] getParameterPositions(CAstEntity n) {
+ int offset = 0;
+ Position[] parameterPositions = new Position[ n.getArgumentCount() ];
+ if ((n.getType() instanceof CAstType.Method) && !((CAstType.Method)n.getType()).isStatic()) {
+ offset = 1;
+ }
+ for(int i = 0; i < n.getArgumentCount() - offset; i++) {
+ parameterPositions[i+offset] = n.getPosition(i);
+ }
+ return parameterPositions;
+ }
}
diff --git a/com.ibm.wala.cast.js.html.nu_validator/.classpath b/com.ibm.wala.cast.js.html.nu_validator/.classpath
deleted file mode 100644
index 9993eede2..000000000
--- a/com.ibm.wala.cast.js.html.nu_validator/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.js.html.nu_validator/.gitignore b/com.ibm.wala.cast.js.html.nu_validator/.gitignore
new file mode 100644
index 000000000..9b61c8c04
--- /dev/null
+++ b/com.ibm.wala.cast.js.html.nu_validator/.gitignore
@@ -0,0 +1 @@
+/*.html
diff --git a/com.ibm.wala.cast.js.html.nu_validator/.project b/com.ibm.wala.cast.js.html.nu_validator/.project
deleted file mode 100644
index d963a4a29..000000000
--- a/com.ibm.wala.cast.js.html.nu_validator/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.js.html.nu_validator
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.pde.PluginNature
-
-
diff --git a/com.ibm.wala.cast.js.html.nu_validator/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.html.nu_validator/.settings/org.eclipse.jdt.core.prefs
index e34d86827..75406200d 100644
--- a/com.ibm.wala.cast.js.html.nu_validator/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.js.html.nu_validator/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/com.ibm.wala.cast.js.html.nu_validator/META-INF/MANIFEST.MF b/com.ibm.wala.cast.js.html.nu_validator/META-INF/MANIFEST.MF
index bec69733e..5993c5b2b 100644
--- a/com.ibm.wala.cast.js.html.nu_validator/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.js.html.nu_validator/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.html.nu_validator
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Export-Package: com.ibm.wala.cast.js.html.nu_validator,
com.ibm.wala.cast.js.test
Require-Bundle: com.ibm.wala.cast.js;bundle-version="1.0.0",
diff --git a/com.ibm.wala.cast.js.html.nu_validator/build.gradle b/com.ibm.wala.cast.js.html.nu_validator/build.gradle
new file mode 100644
index 000000000..08fc0b6b8
--- /dev/null
+++ b/com.ibm.wala.cast.js.html.nu_validator/build.gradle
@@ -0,0 +1,29 @@
+sourceSets {
+ main.java.srcDirs = ['src']
+ test.java.srcDirs = ['tests']
+}
+
+dependencies {
+ compile(
+ 'nu.validator.htmlparser:htmlparser:1.4',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.cast.js'),
+ project(':com.ibm.wala.util'),
+ )
+ testCompile(
+ project(':com.ibm.wala.cast.test'),
+ project(':com.ibm.wala.core.tests'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.cast.js.rhino.test'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.cast.js.test'),
+ )
+}
+
+processTestResources {
+ def data = project(':com.ibm.wala.cast.js.test.data')
+ dependsOn data.processTestResources
+ from data.sourceSets.test.resources
+}
+
+test {
+ maxHeapSize = '800M'
+}
diff --git a/com.ibm.wala.cast.js.html.nu_validator/pom.xml b/com.ibm.wala.cast.js.html.nu_validator/pom.xml
index 1610139c4..8da1abec9 100644
--- a/com.ibm.wala.cast.js.html.nu_validator/pom.xml
+++ b/com.ibm.wala.cast.js.html.nu_validator/pom.xml
@@ -5,7 +5,7 @@
WALA
com.ibm.wala
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.js.html.nu_validator
eclipse-plugin
@@ -61,7 +61,7 @@
junit
junit
- 4.11
+ 4.12
test
diff --git a/com.ibm.wala.cast.js.nodejs.test/.classpath b/com.ibm.wala.cast.js.nodejs.test/.classpath
deleted file mode 100644
index 238fb5a24..000000000
--- a/com.ibm.wala.cast.js.nodejs.test/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.js.nodejs.test/.project b/com.ibm.wala.cast.js.nodejs.test/.project
deleted file mode 100644
index 78dc45c70..000000000
--- a/com.ibm.wala.cast.js.nodejs.test/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.js.nodejs.test
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.pde.PluginNature
-
-
diff --git a/com.ibm.wala.cast.js.nodejs.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.nodejs.test/.settings/org.eclipse.jdt.core.prefs
index c3c668c66..b2029a149 100644
--- a/com.ibm.wala.cast.js.nodejs.test/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.js.nodejs.test/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/com.ibm.wala.cast.js.nodejs.test/META-INF/MANIFEST.MF b/com.ibm.wala.cast.js.nodejs.test/META-INF/MANIFEST.MF
index 7c38ef4e5..b4387e191 100644
--- a/com.ibm.wala.cast.js.nodejs.test/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.js.nodejs.test/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.nodejs.test
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Export-Package: NodejsRequireJsonTest,
NodejsRequireTargetSelectorResolve,
NodejsRequireTargetSelectorResolve.requireDynamic,
diff --git a/com.ibm.wala.cast.js.nodejs.test/build.gradle b/com.ibm.wala.cast.js.nodejs.test/build.gradle
new file mode 100644
index 000000000..3193d3fcd
--- /dev/null
+++ b/com.ibm.wala.cast.js.nodejs.test/build.gradle
@@ -0,0 +1,19 @@
+sourceSets.test {
+ java.srcDirs = ['src']
+ resources.srcDirs = ['testdata']
+}
+
+dependencies {
+ testCompile(
+ 'junit:junit:4.12',
+ project(':com.ibm.wala.cast.js.nodejs'),
+ project(':com.ibm.wala.core'),
+ )
+}
+
+test {
+ maxHeapSize = '800M'
+
+ // fails with java.lang.OutOfMemoryError for unknown reasons
+ exclude '**/NodejsRequireTargetSelectorResolveTest.class'
+}
diff --git a/com.ibm.wala.cast.js.nodejs.test/pom.xml b/com.ibm.wala.cast.js.nodejs.test/pom.xml
index 89f73c0fe..2d64d6248 100644
--- a/com.ibm.wala.cast.js.nodejs.test/pom.xml
+++ b/com.ibm.wala.cast.js.nodejs.test/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.js.nodejs.test
eclipse-plugin
@@ -35,7 +35,7 @@
junit
junit
- 4.11
+ 4.12
test
diff --git a/com.ibm.wala.cast.js.nodejs/.classpath b/com.ibm.wala.cast.js.nodejs/.classpath
deleted file mode 100644
index 45c15b83d..000000000
--- a/com.ibm.wala.cast.js.nodejs/.classpath
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.js.nodejs/.project b/com.ibm.wala.cast.js.nodejs/.project
deleted file mode 100644
index d9ee4a7e5..000000000
--- a/com.ibm.wala.cast.js.nodejs/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.js.nodejs
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.pde.PluginNature
-
-
diff --git a/com.ibm.wala.cast.js.nodejs/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.nodejs/.settings/org.eclipse.jdt.core.prefs
index 3fa024056..60395a5f7 100644
--- a/com.ibm.wala.cast.js.nodejs/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.js.nodejs/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/com.ibm.wala.cast.js.nodejs/META-INF/MANIFEST.MF b/com.ibm.wala.cast.js.nodejs/META-INF/MANIFEST.MF
index 08f676ddb..8184a0c9d 100644
--- a/com.ibm.wala.cast.js.nodejs/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.js.nodejs/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.nodejs
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Export-Package: com.ibm.wala.cast.js.nodejs,
org.json
Require-Bundle: com.ibm.wala.cast.js;bundle-version="1.3.10",
diff --git a/com.ibm.wala.cast.js.nodejs/build.gradle b/com.ibm.wala.cast.js.nodejs/build.gradle
new file mode 100644
index 000000000..fe771d451
--- /dev/null
+++ b/com.ibm.wala.cast.js.nodejs/build.gradle
@@ -0,0 +1,41 @@
+dependencies {
+ compile(
+ 'commons-io:commons-io:2.4',
+ 'org.json:json:20160212',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.cast.js'),
+ project(':com.ibm.wala.cast.js.rhino'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.util'),
+ )
+}
+
+task downloadNodeJS(type: VerifiedDownload) {
+ src 'https://api.github.com/repos/nodejs/node/zipball/0a604e92e258c5ee2752d763e50721e35053f135'
+ dest "$temporaryDir/nodejs.zip"
+ checksum '33c5ba7a5d45644e70d268d8ad3e57df'
+}
+
+task unpackNodeJSLib(type: Copy, dependsOn: downloadNodeJS) {
+ from(zipTree(downloadNodeJS.dest)) {
+ include 'nodejs-node-0a604e9/lib/*.js'
+ eachFile {
+ relativePath new RelativePath(!directory, relativePath.lastName)
+ }
+ }
+
+ into 'dat/core-modules'
+ includeEmptyDirs false
+}
+
+task cleanUnpackNodeJSLib(type: Delete) {
+ delete fileTree(dir: 'dat/core-modules', include: '*.js')
+}
+
+processResources.dependsOn unpackNodeJSLib
+clean.dependsOn cleanUnpackNodeJSLib
+
+sourceSets.main {
+ java.srcDirs = ['src']
+ resources.srcDirs = ['dat']
+}
diff --git a/com.ibm.wala.cast.js.nodejs/pom.xml b/com.ibm.wala.cast.js.nodejs/pom.xml
index 7b9f33f57..fce516932 100644
--- a/com.ibm.wala.cast.js.nodejs/pom.xml
+++ b/com.ibm.wala.cast.js.nodejs/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
eclipse-plugin
com.ibm.wala.cast.js.nodejs
diff --git a/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsRequireTargetSelector.java b/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsRequireTargetSelector.java
index e3b415020..6be756510 100644
--- a/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsRequireTargetSelector.java
+++ b/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsRequireTargetSelector.java
@@ -116,8 +116,6 @@ public class NodejsRequireTargetSelector implements MethodTargetSelector {
IClass script = builder.getClassHierarchy()
.lookupClass(TypeReference.findOrCreate(jsLoader.getReference(), className));
- System.err.println(builder.getClassHierarchy());
-
IMethod method = script.getMethod(AstMethodReference.fnSelector);
previouslyRequired.put(sourceModule.getClassName(), method);
diff --git a/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsRequiredCoreModule.java b/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsRequiredCoreModule.java
index 2b8326013..a90d347b4 100644
--- a/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsRequiredCoreModule.java
+++ b/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsRequiredCoreModule.java
@@ -13,13 +13,16 @@ package com.ibm.wala.cast.js.nodejs;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Files;
import java.util.Arrays;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.io.FilenameUtils;
import com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil;
import com.ibm.wala.classLoader.SourceFileModule;
+import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.io.TemporaryFile;
@@ -51,8 +54,18 @@ public class NodejsRequiredCoreModule extends NodejsRequiredSourceModule {
return NodejsRequiredCoreModule.class.getClassLoader().getResourceAsStream("core-modules/" + name + ".js");
}
+
+ private static final Map names = HashMapFactory.make();
+
public static NodejsRequiredCoreModule make(String name) throws IOException {
- File file = new File(System.getProperty("java.io.tmpdir"), name+".js");
+ if (! names.containsKey(name)) {
+ java.nio.file.Path p = Files.createTempDirectory("nodejs");
+ File f = new File(p.toFile(), name + ".js");
+ f.deleteOnExit();
+ p.toFile().deleteOnExit();
+ names.put(name, f);
+ }
+ File file = names.get(name);
TemporaryFile.streamToFile(file, getModule(name));
SourceFileModule sourceFileModule = CAstCallGraphUtil.makeSourceModule(file.toURI().toURL(), file.getName());
return new NodejsRequiredCoreModule(file, sourceFileModule);
diff --git a/com.ibm.wala.cast.js.rhino.test/.classpath b/com.ibm.wala.cast.js.rhino.test/.classpath
deleted file mode 100644
index d338e402d..000000000
--- a/com.ibm.wala.cast.js.rhino.test/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.js.rhino.test/.project b/com.ibm.wala.cast.js.rhino.test/.project
deleted file mode 100644
index 9b1366589..000000000
--- a/com.ibm.wala.cast.js.rhino.test/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.js.rhino.test
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast.js.rhino.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.rhino.test/.settings/org.eclipse.jdt.core.prefs
index e177f3042..aac706b75 100644
--- a/com.ibm.wala.cast.js.rhino.test/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.js.rhino.test/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/com.ibm.wala.cast.js.rhino.test/META-INF/MANIFEST.MF b/com.ibm.wala.cast.js.rhino.test/META-INF/MANIFEST.MF
index 5f63ec99b..7ad9e37b1 100644
--- a/com.ibm.wala.cast.js.rhino.test/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.js.rhino.test/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.rhino.test
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.cast.js.rhino;bundle-version="1.0.0",
com.ibm.wala.cast.js;bundle-version="1.0.0",
diff --git a/com.ibm.wala.cast.js.rhino.test/build.gradle b/com.ibm.wala.cast.js.rhino.test/build.gradle
new file mode 100644
index 000000000..1a87cc44d
--- /dev/null
+++ b/com.ibm.wala.cast.js.rhino.test/build.gradle
@@ -0,0 +1,41 @@
+plugins {
+ id 'com.github.hauner.jarTest'
+}
+
+sourceSets.test.java.srcDirs = ['harness-src']
+
+dependencies {
+ testCompile(
+ 'junit:junit:4.12',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.cast.js'),
+ project(':com.ibm.wala.cast.js.rhino'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.shrike'),
+ project(':com.ibm.wala.util'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.cast.js.test'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.cast.test'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.core.tests'),
+ )
+}
+
+processTestResources {
+ def data = project(':com.ibm.wala.cast.js.test.data')
+ dependsOn data.processTestResources
+ from data.sourceSets.test.resources
+}
+
+test {
+ environment 'TRAVIS', 1
+ maxHeapSize = '800M'
+
+ if (gradle.startParameter.offline)
+ exclude '**/FieldBasedJQueryTest.class'
+}
+
+task cleanTestExtras(type: Delete) {
+ delete 'actual.dump'
+ delete 'expected.dump'
+}
+
+cleanTest.dependsOn cleanTestExtras
diff --git a/com.ibm.wala.cast.js.rhino.test/build.properties b/com.ibm.wala.cast.js.rhino.test/build.properties
index e19e77648..77d1a808b 100644
--- a/com.ibm.wala.cast.js.rhino.test/build.properties
+++ b/com.ibm.wala.cast.js.rhino.test/build.properties
@@ -1,6 +1,5 @@
source.. = harness-src/
-output.. = bin/,\
- /com.ibm.wala.cast.js.test.data/examples-src/
+output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/l10n/bundle.properties,\
diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java
index 2684e7af3..2a53ff30b 100644
--- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java
+++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java
@@ -16,8 +16,9 @@ public class FieldBasedCGGamesTest extends AbstractFieldBasedTest {
public void testBunnyHunt() throws IOException, WalaException, Error, CancelException {
runTestExceptOnTravis(new URL("http://www.themaninblue.com/experiment/BunnyHunt/"), new Object[][]{}, BuilderType.OPTIMISTIC);
}
-
- @Test
+
+ // seems to break with http issues
+ //@Test
public void testBeslimed() throws IOException, WalaException, Error, CancelException {
runTestExceptOnTravis(new URL("http://www.markus-inger.de/test/game.php"), new Object[][]{}, BuilderType.OPTIMISTIC);
}
diff --git a/com.ibm.wala.cast.js.rhino.test/launchers/JsViewerDriver.launch b/com.ibm.wala.cast.js.rhino.test/launchers/JsViewerDriver.launch
index a86923eba..2f889885f 100644
--- a/com.ibm.wala.cast.js.rhino.test/launchers/JsViewerDriver.launch
+++ b/com.ibm.wala.cast.js.rhino.test/launchers/JsViewerDriver.launch
@@ -1,13 +1,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com.ibm.wala.cast.js.rhino.test/launchers/TestForInLoopHackRhino.launch b/com.ibm.wala.cast.js.rhino.test/launchers/TestForInLoopHackRhino.launch
index 70e3ecc8d..040acce0f 100644
--- a/com.ibm.wala.cast.js.rhino.test/launchers/TestForInLoopHackRhino.launch
+++ b/com.ibm.wala.cast.js.rhino.test/launchers/TestForInLoopHackRhino.launch
@@ -11,6 +11,7 @@
+
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 e979be029..135f3fabb 100644
--- a/com.ibm.wala.cast.js.rhino.test/launchers/TestMozillaBugPagesRhino.launch
+++ b/com.ibm.wala.cast.js.rhino.test/launchers/TestMozillaBugPagesRhino.launch
@@ -15,6 +15,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 f20f3a830..2081a4ca2 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,6 +22,7 @@
+
diff --git a/com.ibm.wala.cast.js.rhino.test/pom.xml b/com.ibm.wala.cast.js.rhino.test/pom.xml
index b28a96c89..2a857ce46 100644
--- a/com.ibm.wala.cast.js.rhino.test/pom.xml
+++ b/com.ibm.wala.cast.js.rhino.test/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.js.rhino.test
eclipse-plugin
@@ -38,7 +38,7 @@
junit
junit
- 4.11
+ 4.12
test
diff --git a/com.ibm.wala.cast.js.rhino/.classpath b/com.ibm.wala.cast.js.rhino/.classpath
deleted file mode 100644
index f984de818..000000000
--- a/com.ibm.wala.cast.js.rhino/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.js.rhino/.project b/com.ibm.wala.cast.js.rhino/.project
deleted file mode 100644
index 0c4c29ceb..000000000
--- a/com.ibm.wala.cast.js.rhino/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.js.rhino
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast.js.rhino/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.rhino/.settings/org.eclipse.jdt.core.prefs
index 8655daba1..7b0f37f66 100644
--- a/com.ibm.wala.cast.js.rhino/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.js.rhino/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/com.ibm.wala.cast.js.rhino/META-INF/MANIFEST.MF b/com.ibm.wala.cast.js.rhino/META-INF/MANIFEST.MF
index 99259b787..ca8f177d7 100644
--- a/com.ibm.wala.cast.js.rhino/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.js.rhino/META-INF/MANIFEST.MF
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.rhino
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
-Require-Bundle: com.ibm.wala.cast;bundle-version="1.4.4",
- com.ibm.wala.cast.js;bundle-version="1.4.4",
- com.ibm.wala.core;bundle-version="1.4.4",
- com.ibm.wala.util;bundle-version="1.4.4"
+Require-Bundle: com.ibm.wala.cast;bundle-version="1.5.1.qualifier",
+ com.ibm.wala.cast.js;bundle-version="1.5.1.qualifier",
+ com.ibm.wala.core;bundle-version="1.5.1.qualifier",
+ com.ibm.wala.util;bundle-version="1.5.1.qualifier"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: com.ibm.wala.cast.js.translator,
@@ -33,4 +33,4 @@ Export-Package: com.ibm.wala.cast.js.translator,
org.mozilla.javascript.xml,
org.mozilla.javascript.xmlimpl
Bundle-ClassPath: .,
- lib/rhino-1.7.6.jar
+ lib/rhino-1.7.10.jar
diff --git a/com.ibm.wala.cast.js.rhino/build.gradle b/com.ibm.wala.cast.js.rhino/build.gradle
new file mode 100644
index 000000000..2cd8952df
--- /dev/null
+++ b/com.ibm.wala.cast.js.rhino/build.gradle
@@ -0,0 +1,11 @@
+sourceSets.main.java.srcDirs = ['source']
+
+dependencies {
+ compile(
+ 'org.mozilla:rhino:1.7.10',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.cast.js'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.util'),
+ )
+}
diff --git a/com.ibm.wala.cast.js.rhino/build.properties b/com.ibm.wala.cast.js.rhino/build.properties
index aa311189f..6a0a0e501 100644
--- a/com.ibm.wala.cast.js.rhino/build.properties
+++ b/com.ibm.wala.cast.js.rhino/build.properties
@@ -2,8 +2,8 @@ source.. = source/
output.. = bin/
bin.includes = META-INF/,\
.,\
- lib/rhino-1.7.6.jar,\
+ lib/rhino-1.7.10.jar,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
-jars.extra.classpath = lib/rhino-1.7.6.jar
+jars.extra.classpath = lib/rhino-1.7.10.jar
javacProjectSettings = true
diff --git a/com.ibm.wala.cast.js.rhino/mvncentral.xml b/com.ibm.wala.cast.js.rhino/mvncentral.xml
index 6e9dbdd96..38ea06a20 100644
--- a/com.ibm.wala.cast.js.rhino/mvncentral.xml
+++ b/com.ibm.wala.cast.js.rhino/mvncentral.xml
@@ -5,7 +5,7 @@
4.0.0
com.ibm.wala
com.ibm.wala.cast.js.rhino
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
jar
WALA CAst JS Rhino
WALA JS Rhino adapter
@@ -45,22 +45,22 @@
com.ibm.wala
com.ibm.wala.util
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.core
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.cast
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.cast.js
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
org.mozilla
diff --git a/com.ibm.wala.cast.js.rhino/pom.xml b/com.ibm.wala.cast.js.rhino/pom.xml
index 8eeba1b5c..d9aade2b2 100644
--- a/com.ibm.wala.cast.js.rhino/pom.xml
+++ b/com.ibm.wala.cast.js.rhino/pom.xml
@@ -6,7 +6,7 @@
WALA
com.ibm.wala
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.js.rhino
eclipse-plugin
@@ -24,7 +24,7 @@
org.mozilla
rhino
- 1.7.6
+ 1.7.10
jar
false
diff --git a/com.ibm.wala.cast.js.rhino/source/com/ibm/wala/cast/js/translator/RhinoToAstTranslator.java b/com.ibm.wala.cast.js.rhino/source/com/ibm/wala/cast/js/translator/RhinoToAstTranslator.java
index 2e2451377..dfdd6c5dc 100644
--- a/com.ibm.wala.cast.js.rhino/source/com/ibm/wala/cast/js/translator/RhinoToAstTranslator.java
+++ b/com.ibm.wala.cast.js.rhino/source/com/ibm/wala/cast/js/translator/RhinoToAstTranslator.java
@@ -393,7 +393,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
* Used to represent a script or function in the CAst; see walkEntity().
*
*/
- private static class ScriptOrFnEntity implements CAstEntity {
+ private class ScriptOrFnEntity implements CAstEntity {
private final String[] arguments;
private final String name;
@@ -409,6 +409,10 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
private final CAstSourcePositionMap pos;
private final Position entityPosition;
+
+ private final Position namePosition;
+
+ private final Position[] paramPositions;
private ScriptOrFnEntity(AstNode n, Map> subs, CAstNode ast, CAstControlFlowMap map, CAstSourcePositionMap pos, String name) {
this.name = name;
@@ -416,6 +420,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
if (n instanceof FunctionNode) {
FunctionNode f = (FunctionNode) n;
+ namePosition = makePosition(f.getFunctionName());
f.flattenSymbolTable(false);
int i = 0;
arguments = new String[f.getParamCount() + 2];
@@ -424,8 +429,17 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
for (int j = 0; j < f.getParamCount(); j++) {
arguments[i++] = f.getParamOrVarName(j);
}
+
+ List params = f.getParams();
+ paramPositions = new Position[ params.size() ];
+ for(int pi = 0; pi < params.size(); pi++) {
+ paramPositions[pi] = makePosition(params.get(pi));
+ }
+
} else {
+ paramPositions = new Position[0];
arguments = new String[0];
+ namePosition = null;
}
kind = (n instanceof FunctionNode) ? CAstEntity.FUNCTION_ENTITY : CAstEntity.SCRIPT_ENTITY;
this.subs = subs;
@@ -523,6 +537,16 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
public CAstType getType() {
return JSAstTranslator.Any;
}
+
+ @Override
+ public Position getPosition(int arg) {
+ return paramPositions[arg];
+ }
+
+ @Override
+ public Position getNamePosition() {
+ return namePosition;
+ }
}
private CAstEntity walkEntity(final AstNode n, List body, String name, WalkContext child) {
@@ -554,18 +578,22 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
}
private Position makePosition(AstNode n) {
- URL url = ((SourceModule)sourceModule).getURL();
- int line = n.getLineno();
- Position pos = new RangePosition(url, line, n.getAbsolutePosition(), n.getAbsolutePosition()+n.getLength());
+ if (n != null) {
+ URL url = ((SourceModule)sourceModule).getURL();
+ int line = n.getLineno();
+ Position pos = new RangePosition(url, line, n.getAbsolutePosition(), n.getAbsolutePosition()+n.getLength());
- if (sourceModule instanceof MappedSourceModule) {
- Position np = ((MappedSourceModule) sourceModule).getMapping().getIncludedPosition(pos);
- if (np != null) {
- return np;
+ if (sourceModule instanceof MappedSourceModule) {
+ Position np = ((MappedSourceModule) sourceModule).getMapping().getIncludedPosition(pos);
+ if (np != null) {
+ return np;
+ }
}
- }
- return pos;
+ return pos;
+ } else {
+ return null;
+ }
}
protected CAstNode noteSourcePosition(WalkContext context, CAstNode n, AstNode p) {
@@ -840,6 +868,8 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
@Override
public CAstNode visitForInLoop(ForInLoop node, WalkContext arg) {
+ CAstNode loop;
+ CAstNode get;
// TODO: fix the correlation-tracking rewriters, and kill the old for..in translation
if (useNewForIn) {
// set up
@@ -887,7 +917,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
visit(node.getBody(), loopContext),
garbageLabel);
- CAstNode loop = Ast.makeNode(CAstNode.LOCAL_SCOPE,
+ loop = Ast.makeNode(CAstNode.LOCAL_SCOPE,
Ast.makeNode(CAstNode.BLOCK_STMT,
loopHeader[0],
loopHeader[1],
@@ -899,14 +929,13 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
Ast.makeNode(CAstNode.BLOCK_EXPR,
Ast.makeNode(CAstNode.ASSIGN,
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(name)),
- Ast.makeNode(CAstNode.EACH_ELEMENT_GET,
+ get = Ast.makeNode(CAstNode.EACH_ELEMENT_GET,
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(tempName)),
readName(arg, null, name))),
readName(arg, null, name))),
body),
breakLabel));
arg.cfg().map(node, loop);
- return loop;
} else {
CAstNode object = visit(node.getIteratedObject(), arg);
String tempName = "for in loop temp";
@@ -924,7 +953,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
initNode =
Ast.makeNode(CAstNode.ASSIGN,
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(name)),
- Ast.makeNode(CAstNode.EACH_ELEMENT_GET,
+ get = Ast.makeNode(CAstNode.EACH_ELEMENT_GET,
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(tempName)),
readName(arg, null, name)));
@@ -947,12 +976,20 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
initNode =
Ast.makeNode(CAstNode.ASSIGN,
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(name)),
- Ast.makeNode(CAstNode.EACH_ELEMENT_GET,
+ get = Ast.makeNode(CAstNode.EACH_ELEMENT_GET,
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(tempName)),
readName(arg, null, name)));
}
+ arg.cfg().map(get, get);
+ CAstNode ctch = arg.getCatchTarget();
+ if (ctch != null) {
+ arg.cfg().add(get, ctch, JavaScriptTypes.ReferenceError);
+ } else {
+ arg.cfg().add(get, CAstControlFlowMap.EXCEPTION_TO_EXIT, JavaScriptTypes.ReferenceError);
+ }
+
// body
AstNode breakStmt = makeEmptyLabelStmt("breakLabel");
CAstNode breakLabel = visit(breakStmt, arg);
@@ -968,7 +1005,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
visit(node.getBody(), loopContext),
garbageLabel);
- CAstNode loop = Ast.makeNode(CAstNode.LOCAL_SCOPE,
+ loop = Ast.makeNode(CAstNode.LOCAL_SCOPE,
Ast.makeNode(CAstNode.BLOCK_STMT,
loopHeader[0],
loopHeader[1],
@@ -977,15 +1014,24 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
Ast.makeNode(CAstNode.BINARY_EXPR,
CAstOperator.OP_NE,
Ast.makeConstant(null),
- Ast.makeNode(CAstNode.EACH_ELEMENT_GET,
+ get = Ast.makeNode(CAstNode.EACH_ELEMENT_GET,
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(tempName)),
readName(arg, null, name))),
body),
breakLabel));
arg.cfg().map(node, loop);
- return loop;
}
- }
+
+ arg.cfg().map(get, get);
+ CAstNode ctch = arg.getCatchTarget();
+ if (ctch != null) {
+ arg.cfg().add(get, ctch, JavaScriptTypes.ReferenceError);
+ } else {
+ arg.cfg().add(get, CAstControlFlowMap.EXCEPTION_TO_EXIT, JavaScriptTypes.ReferenceError);
+ }
+
+ return loop;
+ }
@Override
public CAstNode visitForLoop(ForLoop node, WalkContext arg) {
diff --git a/com.ibm.wala.cast.js.test.data/.project b/com.ibm.wala.cast.js.test.data/.project
deleted file mode 100644
index 1c3abaf49..000000000
--- a/com.ibm.wala.cast.js.test.data/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.js.test.data
-
-
-
-
-
- org.eclipse.wst.jsdt.core.javascriptValidator
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.wst.jsdt.core.jsNature
- org.eclipse.pde.PluginNature
-
-
diff --git a/com.ibm.wala.cast.js.test.data/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.test.data/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..a698e5967
--- /dev/null
+++ b/com.ibm.wala.cast.js.test.data/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+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.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+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
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/com.ibm.wala.cast.js.test.data/META-INF/MANIFEST.MF b/com.ibm.wala.cast.js.test.data/META-INF/MANIFEST.MF
index 1436df11d..e11f52c9c 100644
--- a/com.ibm.wala.cast.js.test.data/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.js.test.data/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Eclipse-LazyStart: true
Bundle-Name: %pluginName
Bundle-SymbolicName: com.ibm.wala.cast.js.test.data;singleton:=true
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: examples-src/
diff --git a/com.ibm.wala.cast.js.test.data/build.gradle b/com.ibm.wala.cast.js.test.data/build.gradle
new file mode 100644
index 000000000..89232a1e8
--- /dev/null
+++ b/com.ibm.wala.cast.js.test.data/build.gradle
@@ -0,0 +1,23 @@
+sourceSets.test.resources.srcDirs = ['examples-src']
+
+task downloadAjaxslt(type: VerifiedDownload) {
+ def version = '0.8.1'
+ def versionedArchive = "ajaxslt-${version}.tar.gz"
+ src "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ajaxslt/$versionedArchive"
+ dest "$temporaryDir/$versionedArchive"
+ checksum 'c995abe3310a401bb4db7f28a6409756'
+}
+
+task unpackAjaxslt(type: Sync, dependsOn: downloadAjaxslt) {
+ from(tarTree(downloadAjaxslt.dest)) {
+ eachFile {
+ def newSegments = relativePath.segments[1 .. -1] as String[]
+ relativePath new RelativePath(!directory, newSegments)
+ }
+ }
+ into 'examples-src/ajaxslt'
+}
+
+clean.dependsOn cleanUnpackAjaxslt
+
+processTestResources.dependsOn(unpackAjaxslt)
diff --git a/com.ibm.wala.cast.js.test.data/pom.xml b/com.ibm.wala.cast.js.test.data/pom.xml
index 072dc787a..765a96245 100644
--- a/com.ibm.wala.cast.js.test.data/pom.xml
+++ b/com.ibm.wala.cast.js.test.data/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.js.test.data
eclipse-plugin
diff --git a/com.ibm.wala.cast.js.test/.classpath b/com.ibm.wala.cast.js.test/.classpath
deleted file mode 100755
index ea32f68e7..000000000
--- a/com.ibm.wala.cast.js.test/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.js.test/.cvsignore b/com.ibm.wala.cast.js.test/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/com.ibm.wala.cast.js.test/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/com.ibm.wala.cast.js.test/.launchConfigurations/com.ibm.wala.cast.js.test-JUnit.launch b/com.ibm.wala.cast.js.test/.launchConfigurations/com.ibm.wala.cast.js.test-JUnit.launch
index 98dbca14b..3184e9f7f 100644
--- a/com.ibm.wala.cast.js.test/.launchConfigurations/com.ibm.wala.cast.js.test-JUnit.launch
+++ b/com.ibm.wala.cast.js.test/.launchConfigurations/com.ibm.wala.cast.js.test-JUnit.launch
@@ -1,4 +1,4 @@
-
+
@@ -16,6 +16,7 @@
+
diff --git a/com.ibm.wala.cast.js.test/.project b/com.ibm.wala.cast.js.test/.project
deleted file mode 100644
index a3070e2dd..000000000
--- a/com.ibm.wala.cast.js.test/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.js.test
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast.js.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.test/.settings/org.eclipse.jdt.core.prefs
index df7470c57..5de732f1e 100644
--- a/com.ibm.wala.cast.js.test/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.js.test/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/com.ibm.wala.cast.js.test/META-INF/MANIFEST.MF b/com.ibm.wala.cast.js.test/META-INF/MANIFEST.MF
index 3b723b472..998b3c558 100644
--- a/com.ibm.wala.cast.js.test/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.js.test/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.test
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.cast.js,
com.ibm.wala.cast,
diff --git a/com.ibm.wala.cast.js.test/build.gradle b/com.ibm.wala.cast.js.test/build.gradle
new file mode 100644
index 000000000..37007296f
--- /dev/null
+++ b/com.ibm.wala.cast.js.test/build.gradle
@@ -0,0 +1,29 @@
+plugins {
+ id 'com.github.hauner.jarTest'
+}
+
+sourceSets.test.java.srcDirs = ['harness-src']
+
+dependencies {
+ testCompile(
+ 'junit:junit:4.12',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.cast.js'),
+ project(':com.ibm.wala.cast.js.rhino'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.shrike'),
+ project(':com.ibm.wala.util'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.cast.test'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.core.tests'),
+ )
+}
+
+processTestResources {
+ def data = project(':com.ibm.wala.cast.js.test.data')
+ dependsOn data.processTestResources
+ from data.sourceSets.test.resources
+}
+
+test {
+ maxHeapSize = '800M'
+}
diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPointerAnalyses.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPointerAnalyses.java
index 9af2b023c..21935b7c9 100644
--- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPointerAnalyses.java
+++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPointerAnalyses.java
@@ -23,6 +23,7 @@ import org.junit.Test;
import com.ibm.wala.analysis.pointers.HeapGraph;
import com.ibm.wala.cast.ipa.callgraph.GlobalObjectKey;
import com.ibm.wala.cast.ir.ssa.AstGlobalWrite;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.GlobalVertex;
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.ObjectVertex;
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.PrototypeFieldVertex;
@@ -251,18 +252,18 @@ public abstract class TestPointerAnalyses {
SymbolTable symtab = ir.getSymbolTable();
for(SSAInstruction inst : ir.getInstructions()) {
if (inst instanceof JavaScriptPropertyWrite) {
- int property = ((JavaScriptPropertyWrite) inst).getMemberRef();
+ int property = ((AstPropertyWrite) inst).getMemberRef();
if (symtab.isConstant(property)) {
String p = JSCallGraphUtil.simulateToStringForPropertyNames(symtab.getConstantValue(property));
- int obj = ((JavaScriptPropertyWrite) inst).getObjectRef();
+ int obj = ((AstPropertyWrite) inst).getObjectRef();
PointerKey objKey = fbPA.getHeapModel().getPointerKeyForLocal(node, obj);
OrdinalSet objPtrs = fbPA.getPointsToSet(objKey);
for(ObjectVertex o : objPtrs) {
PointerKey propKey = fbPA.getHeapModel().getPointerKeyForInstanceField(o, new AstDynamicField(false, o.getConcreteType(), Atom.findOrCreateUnicodeAtom(p), JavaScriptTypes.Root));
Assert.assertTrue("object " + o + " should have field " + propKey, hg.hasEdge(o, propKey));
- int val = ((JavaScriptPropertyWrite) inst).getValue();
+ int val = ((AstPropertyWrite) inst).getValue();
PointerKey valKey = fbPA.getHeapModel().getPointerKeyForLocal(node, val);
OrdinalSet valPtrs = fbPA.getPointsToSet(valKey);
for(ObjectVertex v : valPtrs) {
diff --git a/com.ibm.wala.cast.js.test/pom.xml b/com.ibm.wala.cast.js.test/pom.xml
index 6bfefd237..86ba02231 100644
--- a/com.ibm.wala.cast.js.test/pom.xml
+++ b/com.ibm.wala.cast.js.test/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.js.test
eclipse-plugin
@@ -38,7 +38,7 @@
junit
junit
- 4.11
+ 4.12
test
diff --git a/com.ibm.wala.cast.js/.classpath b/com.ibm.wala.cast.js/.classpath
deleted file mode 100644
index 00116fe19..000000000
--- a/com.ibm.wala.cast.js/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast.js/.cvsignore b/com.ibm.wala.cast.js/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/com.ibm.wala.cast.js/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/com.ibm.wala.cast.js/.project b/com.ibm.wala.cast.js/.project
deleted file mode 100644
index ac04b2cc3..000000000
--- a/com.ibm.wala.cast.js/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.js
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast.js/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js/.settings/org.eclipse.jdt.core.prefs
index c3cb0dec9..8491c879c 100644
--- a/com.ibm.wala.cast.js/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.js/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
@@ -17,6 +18,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
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.APILeak=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -34,7 +36,7 @@ org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
@@ -77,7 +79,7 @@ org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariable
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
@@ -90,6 +92,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
diff --git a/com.ibm.wala.cast.js/META-INF/MANIFEST.MF b/com.ibm.wala.cast.js/META-INF/MANIFEST.MF
index 617cec77c..b69cf5847 100644
--- a/com.ibm.wala.cast.js/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.js/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js;singleton:=true
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-ClassPath: .,
lib/jericho-html-3.2.jar
Bundle-Vendor: %Bundle-Vendor
diff --git a/com.ibm.wala.cast.js/build.gradle b/com.ibm.wala.cast.js/build.gradle
new file mode 100644
index 000000000..1424ad156
--- /dev/null
+++ b/com.ibm.wala.cast.js/build.gradle
@@ -0,0 +1,27 @@
+sourceSets.main {
+ java.srcDirs = ['source']
+ resources.srcDirs = ['dat']
+}
+
+dependencies {
+ compile(
+ 'commons-io:commons-io:2.4',
+ 'net.htmlparser.jericho:jericho-html:3.2',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.shrike'),
+ project(':com.ibm.wala.util'),
+ )
+}
+
+task createPackageList(type: CreatePackageList) {
+ sourceSet sourceSets.main.java
+}
+
+javadoc {
+ def rhino = project(':com.ibm.wala.cast.js.rhino').compileJava
+ dependsOn rhino
+ doFirst {
+ classpath += files rhino
+ }
+}
diff --git a/com.ibm.wala.cast.js/mvncentral.xml b/com.ibm.wala.cast.js/mvncentral.xml
index d4ed7f415..755bc47d7 100644
--- a/com.ibm.wala.cast.js/mvncentral.xml
+++ b/com.ibm.wala.cast.js/mvncentral.xml
@@ -5,7 +5,7 @@
4.0.0
com.ibm.wala
com.ibm.wala.cast.js
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
jar
WALA CAst JS
WALA JS frontend
@@ -45,22 +45,22 @@
com.ibm.wala
com.ibm.wala.util
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.core
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.shrike
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.cast
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
net.htmlparser.jericho
diff --git a/com.ibm.wala.cast.js/pom.xml b/com.ibm.wala.cast.js/pom.xml
index 4ec1afd90..a7b37b09d 100644
--- a/com.ibm.wala.cast.js/pom.xml
+++ b/com.ibm.wala.cast.js/pom.xml
@@ -6,7 +6,7 @@
WALA
com.ibm.wala
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.cast.js
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/analysis/typeInference/JSTypeInference.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/analysis/typeInference/JSTypeInference.java
index 40583c065..77e646d8e 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/analysis/typeInference/JSTypeInference.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/analysis/typeInference/JSTypeInference.java
@@ -18,8 +18,6 @@ import com.ibm.wala.cast.analysis.typeInference.AstTypeInference;
import com.ibm.wala.cast.js.ssa.JavaScriptCheckReference;
import com.ibm.wala.cast.js.ssa.JavaScriptInstanceOf;
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyRead;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyWrite;
import com.ibm.wala.cast.js.ssa.JavaScriptTypeOfInstruction;
import com.ibm.wala.cast.js.ssa.JavaScriptWithRegion;
import com.ibm.wala.cast.js.ssa.PrototypeLookup;
@@ -45,11 +43,6 @@ public class JSTypeInference extends AstTypeInference {
result = new DeclaredTypeOperator(new ConeType(cha.getRootClass()));
}
- @Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead inst) {
- result = new DeclaredTypeOperator(new ConeType(cha.getRootClass()));
- }
-
@Override
public void visitTypeOf(JavaScriptTypeOfInstruction inst) {
result = new DeclaredTypeOperator(new PointType(cha.lookupClass(JavaScriptTypes.String)));
@@ -60,10 +53,6 @@ public class JSTypeInference extends AstTypeInference {
result = new DeclaredTypeOperator(new PointType(cha.lookupClass(JavaScriptTypes.Boolean)));
}
- @Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite inst) {
- }
-
@Override
public void visitCheckRef(JavaScriptCheckReference instruction) {
}
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/JSMethodInstructionVisitor.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/JSMethodInstructionVisitor.java
index 25ea5bee5..d2a280833 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/JSMethodInstructionVisitor.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/JSMethodInstructionVisitor.java
@@ -55,7 +55,7 @@ public class JSMethodInstructionVisitor extends JSAbstractInstructionVisitor {
if(fndef instanceof AstGlobalRead) {
AstGlobalRead agr = (AstGlobalRead)fndef;
if(agr.getGlobalName().equals("global Function")) {
- if(invk.getNumberOfParameters() != 2)
+ if(invk.getNumberOfPositionalParameters() != 2)
return false;
// this may be a genuine use of "new Function()", not a declaration/expression
if(!symtab.isStringConstant(invk.getUse(1)))
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/OptimisticCallgraphBuilder.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/OptimisticCallgraphBuilder.java
index 1b7d82377..d574e0de1 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/OptimisticCallgraphBuilder.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/OptimisticCallgraphBuilder.java
@@ -103,7 +103,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
offset = 1;
}
- for(int i=0;i {
DefUse du = cache.getDefUse(getIR(cache, func));
for(SSAInstruction inst : Iterator2Iterable.make(du.getUses(rval))) {
if (inst instanceof JavaScriptPropertyWrite) {
- int obj = ((JavaScriptPropertyWrite) inst).getObjectRef();
+ int obj = ((AstPropertyWrite) inst).getObjectRef();
VarVertex object = factory.makeVarVertex(func, obj);
for(ObjectVertex o : getPointsToSet(object)) {
PrototypeFieldVertex prototype = get(PrototypeField.prototype, o);
@@ -458,7 +459,7 @@ public class FlowGraph implements Iterable {
DefUse du = cache.getDefUse(getIR(cache, func));
for(SSAInstruction inst : Iterator2Iterable.make(du.getUses(rval))) {
if (inst instanceof JavaScriptPropertyWrite) {
- int obj = ((JavaScriptPropertyWrite) inst).getObjectRef();
+ int obj = ((AstPropertyWrite) inst).getObjectRef();
VarVertex object = factory.makeVarVertex(func, obj);
for(ObjectVertex o : getPointsToSet(object)) {
addEdge(ensureNode(o), ensureNode(propertyKey(property.getPropName(), o)));
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/FlowGraphBuilder.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/FlowGraphBuilder.java
index 93b8d8b56..a06520808 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/FlowGraphBuilder.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/flowgraph/FlowGraphBuilder.java
@@ -15,6 +15,8 @@ import com.ibm.wala.cast.ir.ssa.AstGlobalWrite;
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.AstPropertyRead;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
import com.ibm.wala.cast.js.callgraph.fieldbased.JSMethodInstructionVisitor;
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.CreationSiteVertex;
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.FuncVertex;
@@ -24,8 +26,6 @@ import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.VertexFactor
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
import com.ibm.wala.cast.js.ipa.callgraph.JSSSAPropagationCallGraphBuilder;
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyRead;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyWrite;
import com.ibm.wala.cast.js.ssa.PrototypeLookup;
import com.ibm.wala.cast.js.ssa.SetPrototype;
import com.ibm.wala.cast.js.types.JavaScriptMethods;
@@ -255,7 +255,7 @@ public class FlowGraphBuilder {
}
@Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite pw) {
+ public void visitPropertyWrite(AstPropertyWrite pw) {
int p = pw.getMemberRef();
if(symtab.isConstant(p)) {
String pn = JSCallGraphUtil.simulateToStringForPropertyNames(symtab.getConstantValue(p));
@@ -298,7 +298,7 @@ public class FlowGraphBuilder {
}
@Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead pr) {
+ public void visitPropertyRead(AstPropertyRead pr) {
int p = pr.getMemberRef();
if(symtab.isConstant(p)) {
String pn = JSCallGraphUtil.simulateToStringForPropertyNames(symtab.getConstantValue(p));
@@ -392,7 +392,7 @@ public class FlowGraphBuilder {
flowgraph.addEdge(cs, factory.makeVarVertex(func, invk.getDef()));
// also passed as 'this' to constructor
- if (invk.getNumberOfParameters() > 1) {
+ if (invk.getNumberOfPositionalParameters() > 1) {
flowgraph.addEdge(cs, factory.makeVarVertex(func, invk.getUse(0)));
}
}
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/cfg/JSInducedCFG.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/cfg/JSInducedCFG.java
index 2b5451efb..96f87ab7f 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/cfg/JSInducedCFG.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/cfg/JSInducedCFG.java
@@ -15,8 +15,6 @@ import com.ibm.wala.cast.js.ssa.JSInstructionVisitor;
import com.ibm.wala.cast.js.ssa.JavaScriptCheckReference;
import com.ibm.wala.cast.js.ssa.JavaScriptInstanceOf;
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyRead;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyWrite;
import com.ibm.wala.cast.js.ssa.JavaScriptTypeOfInstruction;
import com.ibm.wala.cast.js.ssa.JavaScriptWithRegion;
import com.ibm.wala.cast.js.ssa.PrototypeLookup;
@@ -42,14 +40,6 @@ public class JSInducedCFG extends AstInducedCFG {
breakBasicBlock();
}
- @Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead inst) {
- }
-
- @Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite inst) {
- }
-
@Override
public void visitTypeOf(JavaScriptTypeOfInstruction inst) {
}
@@ -88,14 +78,6 @@ public class JSInducedCFG extends AstInducedCFG {
public void visitJavaScriptInvoke(JavaScriptInvoke inst) {
}
- @Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead inst) {
- }
-
- @Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite inst) {
- }
-
@Override
public void visitTypeOf(JavaScriptTypeOfInstruction inst) {
}
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/JavaScriptAnalysisEngine.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/JavaScriptAnalysisEngine.java
index a58dee362..09bc99bd4 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/JavaScriptAnalysisEngine.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/JavaScriptAnalysisEngine.java
@@ -51,7 +51,7 @@ import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.collections.Pair;
import com.ibm.wala.util.debug.Assertions;
-public abstract class JavaScriptAnalysisEngine extends AbstractAnalysisEngine {
+public abstract class JavaScriptAnalysisEngine extends AbstractAnalysisEngine, Void> {
protected JavaScriptLoaderFactory loaderFactory;
protected JavaScriptTranslatorFactory translatorFactory;
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/impl/ZeroCFABuilderFactory.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/impl/ZeroCFABuilderFactory.java
index 088628fd0..a60b56a94 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/impl/ZeroCFABuilderFactory.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/impl/ZeroCFABuilderFactory.java
@@ -15,6 +15,7 @@ import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions;
import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
+import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
import com.ibm.wala.ipa.cha.IClassHierarchy;
@@ -25,7 +26,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/
public class ZeroCFABuilderFactory {
- public CallGraphBuilder make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha) {
+ public CallGraphBuilder make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector()));
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/WebPageLoaderFactory.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/WebPageLoaderFactory.java
index fb84e43a3..08a272fac 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/WebPageLoaderFactory.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/WebPageLoaderFactory.java
@@ -69,7 +69,7 @@ public class WebPageLoaderFactory extends JavaScriptLoaderFactory {
translateConditionOpcode(CAstOperator.OP_NE),
null,
isDefined,
- context.currentScope().getConstantValue(new Integer(0)),
+ context.currentScope().getConstantValue(Integer.valueOf(0)),
-1));
PreBasicBlock srcB = context.cfg().getCurrentBlock();
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/ArgumentSpecialization.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/ArgumentSpecialization.java
index 2efbf293e..a8c8b20f4 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/ArgumentSpecialization.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/ArgumentSpecialization.java
@@ -27,6 +27,7 @@ import com.ibm.wala.cast.tree.CAstEntity;
import com.ibm.wala.cast.tree.CAstNode;
import com.ibm.wala.cast.tree.impl.CAstImpl;
import com.ibm.wala.cast.tree.rewrite.CAstBasicRewriter;
+import com.ibm.wala.cast.tree.rewrite.CAstBasicRewriter.NonCopyingContext;
import com.ibm.wala.cast.util.CAstPattern;
import com.ibm.wala.cast.util.CAstPattern.Segments;
import com.ibm.wala.cfg.AbstractCFG;
@@ -135,9 +136,9 @@ public class ArgumentSpecialization {
int v = -1;
for (SSAAbstractInvokeInstruction x : caller.getIR().getCalls(site)) {
if (v == -1) {
- v = x.getNumberOfParameters();
+ v = x.getNumberOfPositionalParameters();
} else {
- if (v != x.getNumberOfParameters()) {
+ if (v != x.getNumberOfPositionalParameters()) {
return baseContext;
}
}
@@ -183,12 +184,12 @@ public class ArgumentSpecialization {
if (v != null) {
final JavaScriptLoader myloader = (JavaScriptLoader) method.getDeclaringClass().getClassLoader();
- class FixedArgumentsRewriter extends CAstBasicRewriter {
+ class FixedArgumentsRewriter extends CAstBasicRewriter {
private final CAstEntity e;
private final Map argRefs = HashMapFactory.make();
public FixedArgumentsRewriter(CAst Ast) {
- super(Ast, false);
+ super(Ast, new NonCopyingContext(), false);
this.e = m.getEntity();
for(Segments s : CAstPattern.findAll(destructuredAccessPattern, m.getEntity())) {
argRefs.put(s.getSingle("name").getValue().toString(), s.getSingle("value"));
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSSSAPropagationCallGraphBuilder.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSSSAPropagationCallGraphBuilder.java
index 365cf5e3b..c4064401f 100755
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSSSAPropagationCallGraphBuilder.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSSSAPropagationCallGraphBuilder.java
@@ -28,8 +28,6 @@ import com.ibm.wala.cast.js.ssa.JSInstructionVisitor;
import com.ibm.wala.cast.js.ssa.JavaScriptCheckReference;
import com.ibm.wala.cast.js.ssa.JavaScriptInstanceOf;
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyRead;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyWrite;
import com.ibm.wala.cast.js.ssa.JavaScriptTypeOfInstruction;
import com.ibm.wala.cast.js.ssa.JavaScriptWithRegion;
import com.ibm.wala.cast.js.ssa.PrototypeLookup;
@@ -104,7 +102,7 @@ import com.ibm.wala.util.strings.Atom;
* {@link JSImplicitPointsToSetVisitor#visitAstGlobalRead(AstGlobalRead)}.
* Finally, we need to represent direct flow of the global object to handle
* receiver argument semantics (see
- * {@link org.mozilla.javascript.RhinoToAstTranslator}). To do so, we create a
+ * {@link com.ibm.wala.cast.js.translator.RhinoToAstTranslator}). To do so, we create a
* reference to a global named {@link #GLOBAL_OBJ_VAR_NAME}, which is handled
* specially in {@link JSConstraintVisitor#visitAstGlobalRead(AstGlobalRead)}.
*/
@@ -262,16 +260,6 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
bingo = true;
}
- @Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead instruction) {
- bingo = true;
- }
-
- @Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite instruction) {
- bingo = true;
- }
-
@Override
public void visitTypeOf(JavaScriptTypeOfInstruction inst) {
bingo = true;
@@ -338,16 +326,6 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
}
- @Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead instruction) {
-
- }
-
- @Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite instruction) {
-
- }
-
@Override
public void visitJavaScriptInstanceOf(JavaScriptInstanceOf instruction) {
@@ -543,36 +521,6 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
handleBinaryOp(instruction, node, symbolTable, du);
}
- @Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead instruction) {
- if (AstSSAPropagationCallGraphBuilder.DEBUG_PROPERTIES) {
- Position instructionPosition = getInstructionPosition(instruction);
- if (instructionPosition != null) {
- System.err.println("processing read instruction " + instruction + ", position " + instructionPosition);
- }
- }
- newFieldRead(node, instruction.getUse(0), instruction.getUse(1), instruction.getDef(0));
- }
-
- private Position getInstructionPosition(SSAInstruction instruction) {
- IMethod method = node.getMethod();
- if (method instanceof AstMethod) {
- return ((AstMethod) method).getSourcePosition(instruction.iindex);
- }
- return null;
- }
-
- @Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite instruction) {
- if (AstSSAPropagationCallGraphBuilder.DEBUG_PROPERTIES) {
- Position instructionPosition = getInstructionPosition(instruction);
- if (instructionPosition != null) {
- System.err.println("processing write instruction " + instruction + ", position " + instructionPosition);
- }
- }
- newFieldWrite(node, instruction.getUse(0), instruction.getUse(1), instruction.getUse(2));
- }
-
@Override
public void visitJavaScriptInvoke(JavaScriptInvoke instruction) {
if (instruction.getDeclaredTarget().equals(JavaScriptMethods.dispatchReference)) {
@@ -1035,7 +983,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
}
int paramCount = targetST.getParameterValueNumbers().length;
- int argCount = instruction.getNumberOfParameters();
+ int argCount = instruction.getNumberOfPositionalParameters();
// the first two arguments are the function object and the receiver, neither of which
// should become part of the arguments array
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JavaScriptConstructTargetSelector.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JavaScriptConstructTargetSelector.java
index ed50a5ff6..04bfabd55 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JavaScriptConstructTargetSelector.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JavaScriptConstructTargetSelector.java
@@ -46,7 +46,7 @@ public class JavaScriptConstructTargetSelector implements MethodTargetSelector {
IR callerIR = caller.getIR();
SSAAbstractInvokeInstruction callStmts[] = callerIR.getCalls(site);
assert callStmts.length == 1;
- int nargs = callStmts[0].getNumberOfParameters();
+ int nargs = callStmts[0].getNumberOfPositionalParameters();
return constructors.findOrCreateConstructorMethod(callerIR, callStmts[0], receiver, nargs - 1);
} else {
return base.getCalleeTarget(caller, site, receiver);
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JavaScriptFunctionDotCallTargetSelector.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JavaScriptFunctionDotCallTargetSelector.java
index c9187f431..585ba4804 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JavaScriptFunctionDotCallTargetSelector.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JavaScriptFunctionDotCallTargetSelector.java
@@ -194,7 +194,7 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
IR callerIR = caller.getIR();
SSAAbstractInvokeInstruction callStmts[] = callerIR.getCalls(site);
assert callStmts.length == 1;
- int nargs = callStmts[0].getNumberOfParameters();
+ int nargs = callStmts[0].getNumberOfPositionalParameters();
return nargs;
}
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/PropertyNameContextSelector.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/PropertyNameContextSelector.java
index b9ed63d0c..22843016d 100755
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/PropertyNameContextSelector.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/PropertyNameContextSelector.java
@@ -132,7 +132,7 @@ public class PropertyNameContextSelector implements ContextSelector {
SSAAbstractInvokeInstruction inst = caller.getIR().getCalls(site)[0];
DefUse du = caller.getDU();
- for(int i = 0; i < inst.getNumberOfParameters(); i++) {
+ for(int i = 0; i < inst.getNumberOfPositionalParameters(); i++) {
MutableIntSet values = IntSetUtil.make();
values.add(inst.getUse(i));
collectValues(du, du.getDef(inst.getUse(i)), values);
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/EscapeCorrelation.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/EscapeCorrelation.java
index b283b27ea..bf03a6ffe 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/EscapeCorrelation.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/EscapeCorrelation.java
@@ -48,7 +48,7 @@ public class EscapeCorrelation extends Correlation {
}
public int getNumberOfArguments() {
- return invoke.getNumberOfParameters() - 2; // deduct one for the function object, one for the receiver
+ return invoke.getNumberOfPositionalParameters() - 2; // deduct one for the function object, one for the receiver
}
@Override
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ClosureExtractor.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ClosureExtractor.java
index 110e318ce..c39f05b8c 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ClosureExtractor.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ClosureExtractor.java
@@ -562,6 +562,10 @@ public class ClosureExtractor extends CAstRewriterExt {
public CAstNodeTypeMap newTypes() { return theTypes; }
@Override
public Map> newChildren() { return theChildren; }
+ @Override
+ public CAstNode[] newDefaults() {
+ return null;
+ }
};
new_entity.setRewrite(rw);
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ExtractedFunction.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ExtractedFunction.java
index 7a061765e..98114aead 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ExtractedFunction.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/ExtractedFunction.java
@@ -186,4 +186,14 @@ class ExtractedFunction implements CAstEntity {
public String toString() {
return "";
}
+
+ @Override
+ public Position getPosition(int arg) {
+ return null;
+ }
+
+ @Override
+ public Position getNamePosition() {
+ return null;
+ }
}
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/modref/JavaScriptModRef.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/modref/JavaScriptModRef.java
index 74019b089..efd21d650 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/modref/JavaScriptModRef.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/modref/JavaScriptModRef.java
@@ -12,14 +12,13 @@
package com.ibm.wala.cast.js.ipa.modref;
import java.util.Collection;
+
import com.ibm.wala.cast.ipa.callgraph.AstHeapModel;
import com.ibm.wala.cast.ipa.modref.AstModRef;
import com.ibm.wala.cast.js.ssa.JSInstructionVisitor;
import com.ibm.wala.cast.js.ssa.JavaScriptCheckReference;
import com.ibm.wala.cast.js.ssa.JavaScriptInstanceOf;
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyRead;
-import com.ibm.wala.cast.js.ssa.JavaScriptPropertyWrite;
import com.ibm.wala.cast.js.ssa.JavaScriptTypeOfInstruction;
import com.ibm.wala.cast.js.ssa.JavaScriptWithRegion;
import com.ibm.wala.cast.js.ssa.PrototypeLookup;
@@ -29,13 +28,12 @@ import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
import com.ibm.wala.ipa.modref.ExtendedHeapModel;
-import com.ibm.wala.util.collections.Iterator2Iterable;
public class JavaScriptModRef extends AstModRef {
- protected static class JavaScriptRefVisitor extends AstRefVisitor implements JSInstructionVisitor {
+ public static class JavaScriptRefVisitor extends AstRefVisitor implements JSInstructionVisitor {
- protected JavaScriptRefVisitor(CGNode n, Collection result, PointerAnalysis pa, ExtendedHeapModel h) {
+ public JavaScriptRefVisitor(CGNode n, Collection result, PointerAnalysis pa, ExtendedHeapModel h) {
super(n, result, pa, (AstHeapModel)h);
}
@@ -49,25 +47,6 @@ public class JavaScriptModRef extends AstModRef {
// do nothing
}
- @Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead instruction) {
- PointerKey obj = h.getPointerKeyForLocal(n, instruction.getObjectRef());
- PointerKey prop = h.getPointerKeyForLocal(n, instruction.getMemberRef());
- for(InstanceKey o : pa.getPointsToSet(obj)) {
- for(InstanceKey p : pa.getPointsToSet(prop)) {
- for(PointerKey x : Iterator2Iterable.make(h.getPointerKeysForReflectedFieldRead(o, p))) {
- assert x != null : instruction;
- result.add(x);
- }
- }
- }
- }
-
- @Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite instruction) {
- // do nothing
- }
-
@Override
public void visitJavaScriptInstanceOf(JavaScriptInstanceOf instruction) {
// do nothing
@@ -101,9 +80,9 @@ public class JavaScriptModRef extends AstModRef {
return new JavaScriptRefVisitor<>(n, result, pa, h);
}
- protected static class JavaScriptModVisitor extends AstModVisitor implements JSInstructionVisitor {
+ public static class JavaScriptModVisitor extends AstModVisitor implements JSInstructionVisitor {
- protected JavaScriptModVisitor(CGNode n, Collection result, ExtendedHeapModel h, PointerAnalysis pa) {
+ public JavaScriptModVisitor(CGNode n, Collection result, ExtendedHeapModel h, PointerAnalysis pa) {
super(n, result, (AstHeapModel)h, pa);
}
@@ -117,24 +96,6 @@ public class JavaScriptModRef extends AstModRef {
// do nothing
}
- @Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead instruction) {
- // do nothing
- }
-
- @Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite instruction) {
- PointerKey obj = h.getPointerKeyForLocal(n, instruction.getObjectRef());
- PointerKey prop = h.getPointerKeyForLocal(n, instruction.getMemberRef());
- for(T o : pa.getPointsToSet(obj)) {
- for(T p : pa.getPointsToSet(prop)) {
- for(PointerKey x : Iterator2Iterable.make(h.getPointerKeysForReflectedFieldWrite(o, p))) {
- assert x != null : instruction;
- result.add(x);
- }
- }
- }
- }
@Override
public void visitJavaScriptInstanceOf(JavaScriptInstanceOf instruction) {
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/summaries/JavaScriptConstructorFunctions.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/summaries/JavaScriptConstructorFunctions.java
index 038e45ce4..c237f4726 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/summaries/JavaScriptConstructorFunctions.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/summaries/JavaScriptConstructorFunctions.java
@@ -102,7 +102,7 @@ public class JavaScriptConstructorFunctions {
//S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
S.getNextProgramCounter();
- S.addConstant(new Integer(8), new ConstantValue(value));
+ S.addConstant(Integer.valueOf(8), new ConstantValue(value));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 5, 8, "$value"));
if (value instanceof String) {
S.addConstant(9, new ConstantValue(0));
@@ -146,7 +146,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeValueConstructor(IClass cls, int nargs, Object value) {
if (nargs == 0 || nargs == 1) {
- Object key = Pair.make(cls, new Integer(nargs));
+ Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@@ -197,7 +197,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeObjectConstructor(IClass cls, int nargs) {
if (nargs == 0 || nargs == 1) {
- Object key = Pair.make(cls, new Integer(nargs));
+ Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@@ -213,7 +213,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeObjectCall(IClass cls, int nargs) {
assert nargs == 0;
- Object key = Pair.make(cls, new Integer(nargs));
+ Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@@ -251,7 +251,7 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
JavaScriptSummary S = new JavaScriptSummary(ref, nargs + 1);
- S.addConstant(new Integer(nargs + 3), new ConstantValue("prototype"));
+ S.addConstant(Integer.valueOf(nargs + 3), new ConstantValue("prototype"));
S.addStatement(insts.PropertyRead(S.getNumberOfStatements(), nargs + 4, 1, nargs + 3));
S.getNextProgramCounter();
@@ -263,13 +263,13 @@ public class JavaScriptConstructorFunctions {
//S.addStatement(insts.PutInstruction(nargs + 5, nargs + 4, "__proto__"));
S.getNextProgramCounter();
- S.addConstant(new Integer(nargs + 7), new ConstantValue(nargs));
+ S.addConstant(Integer.valueOf(nargs + 7), new ConstantValue(nargs));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), nargs + 5, nargs + 7, "length"));
S.getNextProgramCounter();
int vn = nargs + 9;
for (int i = 0; i < nargs; i++, vn += 2) {
- S.addConstant(new Integer(vn), new ConstantValue(i));
+ S.addConstant(Integer.valueOf(vn), new ConstantValue(i));
S.addStatement(insts.PropertyWrite(S.getNumberOfStatements(), nargs + 5, vn, i + 1));
S.getNextProgramCounter();
}
@@ -283,7 +283,7 @@ public class JavaScriptConstructorFunctions {
}
private IMethod makeArrayConstructor(IClass cls, int nargs) {
- Object key = Pair.make(cls, new Integer(nargs));
+ Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@@ -296,9 +296,9 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.String);
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
- S.addConstant(new Integer(2), new ConstantValue(""));
+ S.addConstant(Integer.valueOf(2), new ConstantValue(""));
- S.addConstant(new Integer(3), new ConstantValue(0));
+ S.addConstant(Integer.valueOf(3), new ConstantValue(0));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 2, 3, "length"));
S.getNextProgramCounter();
@@ -328,7 +328,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeStringCall(IClass cls, int nargs) {
assert nargs == 0 || nargs == 1;
- Object key = Pair.make(cls, new Integer(nargs));
+ Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@@ -341,7 +341,7 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.Number);
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
- S.addConstant(new Integer(2), new ConstantValue(0.0));
+ S.addConstant(Integer.valueOf(2), new ConstantValue(0.0));
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 2, false));
S.getNextProgramCounter();
@@ -368,7 +368,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeNumberCall(IClass cls, int nargs) {
assert nargs == 0 || nargs == 1;
- Object key = Pair.make(cls, new Integer(nargs));
+ Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@@ -552,7 +552,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeFunctionObjectConstructor(IClass cls, int nargs) {
JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory();
- Object key = Pair.make(cls, new Integer(nargs));
+ Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@@ -601,7 +601,7 @@ public class JavaScriptConstructorFunctions {
assert nargs == 1;
return makeValueConstructor(receiver, nargs, null);
} else if (receiver.getReference().equals(JavaScriptTypes.NumberObject))
- return makeValueConstructor(receiver, nargs, new Integer(0));
+ return makeValueConstructor(receiver, nargs, Integer.valueOf(0));
else if (receiver.getReference().equals(JavaScriptTypes.Function))
return makeFunctionConstructor(callerIR, callStmt, receiver, nargs);
else if (cha.isSubclassOf(receiver, cha.lookupClass(JavaScriptTypes.CodeBody)))
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/loader/JavaScriptLoader.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/loader/JavaScriptLoader.java
index 8d267cbc1..11ab09a92 100755
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/loader/JavaScriptLoader.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/loader/JavaScriptLoader.java
@@ -26,6 +26,9 @@ 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.AstPropertyRead;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
+import com.ibm.wala.cast.ir.ssa.AstYieldInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
import com.ibm.wala.cast.ir.translator.AstTranslator.AstLexicalInformation;
@@ -34,6 +37,8 @@ import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
import com.ibm.wala.cast.ir.translator.TranslatorToIR;
import com.ibm.wala.cast.js.analysis.typeInference.JSPrimitiveType;
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraph.JSFakeRoot;
+import com.ibm.wala.cast.js.ipa.modref.JavaScriptModRef;
+import com.ibm.wala.cast.js.ipa.modref.JavaScriptModRef.JavaScriptRefVisitor;
import com.ibm.wala.cast.js.ssa.JSInstructionFactory;
import com.ibm.wala.cast.js.ssa.JavaScriptCheckReference;
import com.ibm.wala.cast.js.ssa.JavaScriptInstanceOf;
@@ -65,9 +70,16 @@ import com.ibm.wala.classLoader.LanguageImpl;
import com.ibm.wala.classLoader.ModuleEntry;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
+import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.impl.AbstractRootMethod;
+import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
+import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
+import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
import com.ibm.wala.ipa.cha.IClassHierarchy;
+import com.ibm.wala.ipa.modref.ExtendedHeapModel;
+import com.ibm.wala.ipa.modref.ModRef.ModVisitor;
+import com.ibm.wala.ipa.modref.ModRef.RefVisitor;
import com.ibm.wala.shrikeBT.IBinaryOpInstruction.IOperator;
import com.ibm.wala.shrikeBT.IComparisonInstruction.Operator;
import com.ibm.wala.shrikeCT.BootstrapMethodsReader.BootstrapMethod;
@@ -241,12 +253,12 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
}
@Override
- public JavaScriptPropertyRead PropertyRead(int iindex, int result, int objectRef, int memberRef) {
+ public AstPropertyRead PropertyRead(int iindex, int result, int objectRef, int memberRef) {
return new JavaScriptPropertyRead(iindex, result, objectRef, memberRef);
}
@Override
- public JavaScriptPropertyWrite PropertyWrite(int iindex, int objectRef, int memberRef, int value) {
+ public AstPropertyWrite PropertyWrite(int iindex, int objectRef, int memberRef, int value) {
return new JavaScriptPropertyWrite(iindex, objectRef, memberRef, value);
}
@@ -297,6 +309,11 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
return new AstEchoInstruction(iindex, rvals);
}
+ @Override
+ public AstYieldInstruction YieldInstruction(int iindex, int[] rvals) {
+ return new AstYieldInstruction(iindex, rvals);
+ }
+
@Override
public AstGlobalRead GlobalRead(int iindex, int lhs, FieldReference global) {
return new AstGlobalRead(iindex, lhs, global);
@@ -667,6 +684,18 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
return new JSFakeRoot(cha, options, cache);
}
+ @Override
+ public RefVisitor makeRefVisitor(CGNode n,
+ Collection result, PointerAnalysis pa, ExtendedHeapModel h) {
+ return new JavaScriptRefVisitor<>(n, result, pa, h);
+ }
+
+ @Override
+ public ModVisitor makeModVisitor(CGNode n, Collection result,
+ PointerAnalysis pa, ExtendedHeapModel h, boolean ignoreAllocHeapDefs) {
+ return new JavaScriptModRef.JavaScriptModVisitor<>(n, result, h, pa);
+ }
+
};
private final JavaScriptTranslatorFactory translatorFactory;
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSAbstractInstructionVisitor.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSAbstractInstructionVisitor.java
index 6c5a51270..73e4ba909 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSAbstractInstructionVisitor.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSAbstractInstructionVisitor.java
@@ -11,6 +11,8 @@
package com.ibm.wala.cast.js.ssa;
import com.ibm.wala.cast.ir.ssa.AstAbstractInstructionVisitor;
+import com.ibm.wala.cast.ir.ssa.AstPropertyRead;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
public class JSAbstractInstructionVisitor
extends AstAbstractInstructionVisitor
@@ -23,12 +25,12 @@ public class JSAbstractInstructionVisitor
}
@Override
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead instruction) {
+ public void visitPropertyRead(AstPropertyRead instruction) {
}
@Override
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite instruction) {
+ public void visitPropertyWrite(AstPropertyWrite instruction) {
}
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionFactory.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionFactory.java
index 1fcf22e0f..d39320917 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionFactory.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionFactory.java
@@ -29,10 +29,6 @@ public interface JSInstructionFactory extends AstInstructionFactory {
JavaScriptInvoke Invoke(int iindex, int function, int[] params, int exception, CallSiteReference site);
- JavaScriptPropertyRead PropertyRead(int iindex, int result, int objectRef, int memberRef);
-
- JavaScriptPropertyWrite PropertyWrite(int iindex, int objectRef, int memberRef, int value);
-
SSAPutInstruction PutInstruction(int iindex, int ref, int value, String field);
JavaScriptTypeOfInstruction TypeOfInstruction(int iindex, int lval, int object);
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionVisitor.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionVisitor.java
index 347f18d8e..dda40e532 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionVisitor.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionVisitor.java
@@ -17,11 +17,7 @@ public interface JSInstructionVisitor extends AstInstructionVisitor {
public void visitJavaScriptInvoke(JavaScriptInvoke instruction);
public void visitTypeOf(JavaScriptTypeOfInstruction instruction);
-
- public void visitJavaScriptPropertyRead(JavaScriptPropertyRead instruction);
-
- public void visitJavaScriptPropertyWrite(JavaScriptPropertyWrite instruction);
-
+
public void visitJavaScriptInstanceOf(JavaScriptInstanceOf instruction);
public void visitWithRegion(JavaScriptWithRegion instruction);
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptInvoke.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptInvoke.java
index 9d3656bc5..28d267e26 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptInvoke.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptInvoke.java
@@ -80,7 +80,7 @@ public class JavaScriptInvoke extends MultiReturnValueInvokeInstruction {
@Override
public int getNumberOfUses() {
- return getNumberOfParameters();
+ return getNumberOfPositionalParameters();
}
@Override
@@ -126,7 +126,7 @@ public class JavaScriptInvoke extends MultiReturnValueInvokeInstruction {
}
@Override
- public int getNumberOfParameters() {
+ public int getNumberOfPositionalParameters() {
if (params == null) {
return 1;
} else {
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptPropertyRead.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptPropertyRead.java
index c518eb3c2..5c8f3f457 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptPropertyRead.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptPropertyRead.java
@@ -12,33 +12,14 @@ package com.ibm.wala.cast.js.ssa;
import java.util.Collection;
-import com.ibm.wala.cast.ir.ssa.AbstractReflectiveGet;
-import com.ibm.wala.ssa.SSAInstruction;
-import com.ibm.wala.ssa.SSAInstructionFactory;
+import com.ibm.wala.cast.ir.ssa.AstPropertyRead;
import com.ibm.wala.types.TypeReference;
-public class JavaScriptPropertyRead extends AbstractReflectiveGet {
+public class JavaScriptPropertyRead extends AstPropertyRead {
public JavaScriptPropertyRead(int iindex, int result, int objectRef, int memberRef) {
super(iindex, result, objectRef, memberRef);
}
- @Override
- public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
- return
- ((JSInstructionFactory)insts).PropertyRead(iindex,
- defs==null? getDef(): defs[0],
- uses==null? getObjectRef(): uses[0],
- uses==null? getMemberRef(): uses[1]);
- }
-
- /* (non-Javadoc)
- * @see com.ibm.domo.ssa.Instruction#isPEI()
- */
- @Override
- public boolean isPEI() {
- return true;
- }
-
/* (non-Javadoc)
* @see com.ibm.domo.ssa.Instruction#getExceptionTypes()
*/
@@ -46,14 +27,4 @@ public class JavaScriptPropertyRead extends AbstractReflectiveGet {
public Collection getExceptionTypes() {
return Util.typeErrorExceptions();
}
-
- /**
- /* (non-Javadoc)
- * @see com.ibm.wala.ssa.SSAInstruction#visit(com.ibm.wala.ssa.SSAInstruction.IVisitor)
- */
- @Override
- public void visit(IVisitor v) {
- assert v instanceof JSInstructionVisitor;
- ((JSInstructionVisitor)v).visitJavaScriptPropertyRead(this);
- }
}
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptPropertyWrite.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptPropertyWrite.java
index 892c7ef47..6131c2b2c 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptPropertyWrite.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptPropertyWrite.java
@@ -12,47 +12,15 @@ package com.ibm.wala.cast.js.ssa;
import java.util.Collection;
-import com.ibm.wala.cast.ir.ssa.AbstractReflectivePut;
-import com.ibm.wala.ssa.SSAInstruction;
-import com.ibm.wala.ssa.SSAInstructionFactory;
-import com.ibm.wala.ssa.SymbolTable;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
import com.ibm.wala.types.TypeReference;
-public class JavaScriptPropertyWrite extends AbstractReflectivePut {
+public class JavaScriptPropertyWrite extends AstPropertyWrite {
public JavaScriptPropertyWrite(int iindex, int objectRef, int memberRef, int value) {
super(iindex, objectRef, memberRef, value);
}
- @Override
- public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
- return ((JSInstructionFactory)insts).PropertyWrite(iindex, uses == null ? getObjectRef() : uses[0], uses == null ? getMemberRef() : uses[1],
- uses == null ? getValue() : uses[2]);
- }
-
- @Override
- public String toString(SymbolTable symbolTable) {
- return super.toString(symbolTable) + " = " + getValueString(symbolTable, getValue());
- }
-
- /**
- * @see com.ibm.wala.ssa.SSAInstruction#visit(IVisitor)
- */
- @Override
- public void visit(IVisitor v) {
- assert v instanceof JSInstructionVisitor;
- ((JSInstructionVisitor) v).visitJavaScriptPropertyWrite(this);
- }
-
- /*
- * (non-Javadoc)
- * @see com.ibm.domo.ssa.Instruction#isPEI()
- */
- @Override
- public boolean isPEI() {
- return true;
- }
-
/*
* (non-Javadoc)
* @see com.ibm.domo.ssa.Instruction#getExceptionTypes()
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/translator/JSAstTranslator.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/translator/JSAstTranslator.java
index 76a8fdb04..0a943eeb4 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/translator/JSAstTranslator.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/translator/JSAstTranslator.java
@@ -26,6 +26,7 @@ import com.ibm.wala.cast.loader.DynamicCallSiteReference;
import com.ibm.wala.cast.loader.AstMethod.DebuggingInformation;
import com.ibm.wala.cast.tree.CAstEntity;
import com.ibm.wala.cast.tree.CAstNode;
+import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
import com.ibm.wala.cast.tree.CAstSymbol;
import com.ibm.wala.cast.tree.CAstType;
import com.ibm.wala.cast.tree.impl.CAstSymbolImpl;
@@ -321,35 +322,35 @@ public class JSAstTranslator extends AstTranslator {
if (name.equals("GlobalNaN")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
- resultVal, context.currentScope().getConstantValue(new Float(Float.NaN))));
+ resultVal, context.currentScope().getConstantValue(Float.valueOf(Float.NaN))));
} else if (name.equals("GlobalInfinity")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
- resultVal, context.currentScope().getConstantValue(new Float(Float.POSITIVE_INFINITY))));
+ resultVal, context.currentScope().getConstantValue(Float.valueOf(Float.POSITIVE_INFINITY))));
} else if (name.equals("MathE")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
- resultVal, context.currentScope().getConstantValue(new Double(Math.E))));
+ resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.E))));
} else if (name.equals("MathPI")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
- resultVal, context.currentScope().getConstantValue(new Double(Math.PI))));
+ resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.PI))));
} else if (name.equals("MathSQRT1_2")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
- resultVal, context.currentScope().getConstantValue(new Double(Math.sqrt(.5)))));
+ resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.sqrt(.5)))));
} else if (name.equals("MathSQRT2")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
- resultVal, context.currentScope().getConstantValue(new Double(Math.sqrt(2)))));
+ resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.sqrt(2)))));
} else if (name.equals("MathLN2")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
- resultVal, context.currentScope().getConstantValue(new Double(Math.log(2)))));
+ resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.log(2)))));
} else if (name.equals("MathLN10")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
- resultVal, context.currentScope().getConstantValue(new Double(Math.log(10)))));
+ resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.log(10)))));
} else if (name.equals("NewObject")) {
doNewObject(context, null, resultVal, "Object", null);
@@ -485,4 +486,17 @@ public class JSAstTranslator extends AstTranslator {
return Any;
}
+ @Override
+ protected Position[] getParameterPositions(CAstEntity e) {
+ if (e.getKind() == CAstEntity.SCRIPT_ENTITY) {
+ return new Position[0];
+ } else {
+ Position[] ps = new Position[ e.getArgumentCount() ];
+ for(int i = 2; i < e.getArgumentCount(); i++) {
+ ps[i] = e.getPosition(i-2);
+ }
+ return ps;
+ }
+ }
+
}
diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/translator/JSConstantFoldingRewriter.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/translator/JSConstantFoldingRewriter.java
index 7b7f79600..bbfcbbc81 100644
--- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/translator/JSConstantFoldingRewriter.java
+++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/translator/JSConstantFoldingRewriter.java
@@ -26,7 +26,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
if (lhs instanceof String || rhs instanceof String) {
return "" + lhs + rhs;
} else if (lhs instanceof Number && rhs instanceof Number) {
- return new Double(((Number)lhs).doubleValue() + ((Number)rhs).doubleValue());
+ return Double.valueOf(((Number)lhs).doubleValue() + ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_BIT_AND) {
@@ -43,7 +43,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_DIV) {
if (lhs instanceof Number && rhs instanceof Number) {
- return new Double(((Number)lhs).doubleValue() / ((Number)rhs).doubleValue());
+ return Double.valueOf(((Number)lhs).doubleValue() / ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_EQ) {
@@ -72,12 +72,12 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_MOD) {
if (lhs instanceof Number && rhs instanceof Number) {
- return new Double(((Number)lhs).doubleValue() % ((Number)rhs).doubleValue());
+ return Double.valueOf(((Number)lhs).doubleValue() % ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_MUL) {
if (lhs instanceof Number && rhs instanceof Number) {
- return new Double(((Number)lhs).doubleValue() * ((Number)rhs).doubleValue());
+ return Double.valueOf(((Number)lhs).doubleValue() * ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_NE) {
@@ -98,7 +98,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_SUB) {
if (lhs instanceof Number && rhs instanceof Number) {
- return new Double(((Number)lhs).doubleValue() - ((Number)rhs).doubleValue());
+ return Double.valueOf(((Number)lhs).doubleValue() - ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_URSH) {
diff --git a/com.ibm.wala.cast.test/.classpath b/com.ibm.wala.cast.test/.classpath
deleted file mode 100644
index 0d2c5c3f1..000000000
--- a/com.ibm.wala.cast.test/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
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 afb7832ff..7fde40e03 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
@@ -12,6 +12,7 @@
+
diff --git a/com.ibm.wala.cast.test/.project b/com.ibm.wala.cast.test/.project
deleted file mode 100644
index f9119f4ad..000000000
--- a/com.ibm.wala.cast.test/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- com.ibm.wala.cast.test
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.test/.settings/org.eclipse.jdt.core.prefs
index 1a368b053..f179826c9 100644
--- a/com.ibm.wala.cast.test/.settings/org.eclipse.jdt.core.prefs
+++ b/com.ibm.wala.cast.test/.settings/org.eclipse.jdt.core.prefs
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
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.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
diff --git a/com.ibm.wala.cast.test/META-INF/MANIFEST.MF b/com.ibm.wala.cast.test/META-INF/MANIFEST.MF
index 74a498b1a..4c3426432 100644
--- a/com.ibm.wala.cast.test/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast.test/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.test
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle:
org.junit;bundle-version="4.0.0",
diff --git a/com.ibm.wala.cast.test/build.gradle b/com.ibm.wala.cast.test/build.gradle
new file mode 100644
index 000000000..e9d0ceb2f
--- /dev/null
+++ b/com.ibm.wala.cast.test/build.gradle
@@ -0,0 +1,127 @@
+plugins {
+ id 'com.github.hauner.jarTest'
+ id 'cpp'
+ id 'eclipse'
+ id 'edu.wpi.first.GradleJni' version '0.2.1'
+}
+
+eclipse.project.natures 'org.eclipse.pde.PluginNature'
+prepareIntelliJIDEA.dependsOn jarTest
+
+sourceSets.test.java.srcDirs = ['harness-src/java']
+
+dependencies {
+ testCompile(
+ 'junit:junit:4.12',
+ project(':com.ibm.wala.cast'),
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.util'),
+ project(configuration: 'testArchives', path: ':com.ibm.wala.core.tests'),
+ )
+}
+
+def currentJvm = org.gradle.internal.jvm.Jvm.current()
+
+def addCastRpath(currentJvm, targetPlatform, linker) {
+ switch (targetPlatform.operatingSystem.name) {
+ case 'linux':
+ case 'osx':
+ [
+ // TODO: compute path on following line from 'cast' library properties somehow
+ "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared",
+ // TODO: compute paths on following lines from 'jdk' library properties somehow
+ "${currentJvm.javaHome}/jre/lib/amd64/server",
+ "${currentJvm.javaHome}/jre/lib/server",
+ ].each { linker.args "-Wl,-rpath,$it" }
+ }
+}
+
+model {
+ components {
+ xlator_test(JniNativeLibrarySpec) {
+ javaCompileTasks << compileTestJava
+
+ sources.cpp {
+ source {
+ srcDirs = ['harness-src/c']
+ include 'smoke.cpp'
+ }
+ ['cast', 'jdk'].each {
+ lib project: ':com.ibm.wala.cast', library: it
+ }
+ }
+
+ binaries {
+ withType(StaticLibraryBinarySpec) {
+ buildable = false
+ }
+ withType(SharedLibraryBinarySpec) {
+ addCastRpath(currentJvm, targetPlatform, linker)
+ }
+ }
+ }
+
+ smoke_main(NativeExecutableSpec) {
+ sources.cpp {
+ source {
+ srcDirs = ['harness-src/c']
+ include 'smoke_main.cpp'
+ }
+ ['cast', 'jdk'].each {
+ lib project: ':com.ibm.wala.cast', library: it
+ }
+ }
+
+ binaries.all {
+ addCastRpath(currentJvm, targetPlatform, linker)
+ }
+ }
+ }
+
+ tasks {
+ test {
+ def lib = linkXlator_testSharedLibrary
+ dependsOn lib
+ systemProperty 'java.library.path', lib.destinationDirectory.get().asFile
+ }
+
+ checkSmoke_main(Exec) {
+ // main executable to run for test
+ def executableBinary = $.binaries.smoke_mainExecutable
+ executable executableBinary.executableFile
+ dependsOn executableBinary
+ def pathElements = [$.binaries.test.getClassesDir()]
+
+ // implementations of native methods
+ def library = $.binaries.xlator_testSharedLibrary
+ dependsOn library
+ pathElements << library.sharedLibraryFile.parent
+
+ // "primordial.txt" resource loaded during test
+ def coreResources = project(':com.ibm.wala.core').processResources
+ dependsOn coreResources
+ pathElements << coreResources.destinationDir
+
+ // additional supporting Java class files
+ ['cast', 'core', 'util'].each {
+ def compileJava = project(":com.ibm.wala.$it").compileJava
+ dependsOn compileJava
+ pathElements << compileJava.destinationDir
+ }
+
+ // all combined as a colon-delimited path list
+ args pathElements.join(':')
+
+ // log output to file, although we don't validate it
+ final def outFile = file("$temporaryDir/stdout-and-stderr.log")
+ outputs.file outFile
+ doFirst {
+ final def fileStream = new FileOutputStream(outFile)
+ standardOutput fileStream
+ errorOutput fileStream
+ }
+ }
+
+ check.dependsOn checkSmoke_main
+ }
+}
diff --git a/com.ibm.wala.cast.test/build.properties b/com.ibm.wala.cast.test/build.properties
index 6743cabc9..06b93cd6d 100644
--- a/com.ibm.wala.cast.test/build.properties
+++ b/com.ibm.wala.cast.test/build.properties
@@ -1,7 +1,6 @@
source.. = harness-src/java
-output.. = bin/
+output.. = bin/test
bin.includes = META-INF/,\
.,\
- OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true
diff --git a/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestCAstTranslator.java b/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestCAstTranslator.java
index 5d92e34f1..27f98bad9 100644
--- a/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestCAstTranslator.java
+++ b/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestCAstTranslator.java
@@ -195,7 +195,7 @@ public abstract class TestCAstTranslator extends WalaTestCase {
for (Object name2 : cls.getDeclaredMethods()) {
IMethod mth = (IMethod) name2;
- Integer np = new Integer(mth.getNumberOfParameters());
+ Integer np = Integer.valueOf(mth.getNumberOfParameters());
Pair key = Pair.make(cls.getName().toString(), mth.getName().toString());
if (mth.isStatic()) {
diff --git a/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestConstantCollector.java b/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestConstantCollector.java
new file mode 100644
index 000000000..37d1e9412
--- /dev/null
+++ b/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestConstantCollector.java
@@ -0,0 +1,204 @@
+package com.ibm.wala.cast.test;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.junit.Test;
+
+import com.ibm.wala.cast.tree.CAst;
+import com.ibm.wala.cast.tree.CAstAnnotation;
+import com.ibm.wala.cast.tree.CAstControlFlowMap;
+import com.ibm.wala.cast.tree.CAstEntity;
+import com.ibm.wala.cast.tree.CAstNode;
+import com.ibm.wala.cast.tree.CAstNodeTypeMap;
+import com.ibm.wala.cast.tree.CAstQualifier;
+import com.ibm.wala.cast.tree.CAstSourcePositionMap;
+import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
+import com.ibm.wala.cast.tree.CAstType;
+import com.ibm.wala.cast.tree.impl.CAstImpl;
+import com.ibm.wala.cast.tree.impl.CAstOperator;
+import com.ibm.wala.cast.tree.rewrite.AstConstantFolder;
+import com.ibm.wala.cast.util.AstConstantCollector;
+import com.ibm.wala.cast.util.CAstPattern;
+import com.ibm.wala.cast.util.CAstPattern.Segments;
+import com.ibm.wala.util.collections.EmptyIterator;
+
+public class TestConstantCollector {
+
+ private CAst ast = new CAstImpl();
+
+ private static CAstEntity fakeEntity(CAstNode root) {
+ return new CAstEntity() {
+
+ @Override
+ public int getKind() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getSignature() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String[] getArgumentNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CAstNode[] getArgumentDefaults() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getArgumentCount() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Map> getAllScopedEntities() {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public Iterator getScopedEntities(CAstNode construct) {
+ return EmptyIterator.instance();
+ }
+
+ @Override
+ public CAstNode getAST() {
+ return root;
+ }
+
+ @Override
+ public CAstControlFlowMap getControlFlow() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CAstSourcePositionMap getSourceMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Position getPosition() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CAstNodeTypeMap getNodeTypeMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection getQualifiers() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CAstType getType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection getAnnotations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Position getPosition(int arg) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Position getNamePosition() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+ }
+
+ private CAstNode root1 =
+ ast.makeNode(CAstNode.BLOCK_STMT,
+ ast.makeNode(CAstNode.ASSIGN,
+ ast.makeNode(CAstNode.VAR,
+ ast.makeConstant("var1")),
+ ast.makeConstant(15)));
+
+ @Test
+ public void testSegmentsRoot1() {
+ Collection x = CAstPattern.findAll(AstConstantCollector.simpleValuePattern, fakeEntity(root1));
+ assert x.size() == 1;
+ }
+
+ @Test
+ public void testRoot1() {
+ Map x = AstConstantCollector.collectConstants(fakeEntity(root1));
+ assert x.size() == 1;
+ }
+
+ private CAstNode root2 =
+ ast.makeNode(CAstNode.BLOCK_STMT,
+ ast.makeNode(CAstNode.ASSIGN,
+ ast.makeNode(CAstNode.VAR,
+ ast.makeConstant("var1")),
+ ast.makeConstant(15)),
+ ast.makeNode(CAstNode.ASSIGN,
+ ast.makeNode(CAstNode.VAR,
+ ast.makeConstant("var1")),
+ ast.makeConstant(14)));
+
+ @Test
+ public void testSegmentsRoot2() {
+ Collection x = CAstPattern.findAll(AstConstantCollector.simpleValuePattern, fakeEntity(root2));
+ assert x.size() == 2;
+ }
+
+ @Test
+ public void testRoot2() {
+ Map x = AstConstantCollector.collectConstants(fakeEntity(root2));
+ assert x.size() == 0;
+ }
+
+ private CAstNode root3 =
+ ast.makeNode(CAstNode.BLOCK_EXPR,
+ ast.makeNode(CAstNode.ASSIGN,
+ ast.makeNode(CAstNode.VAR,
+ ast.makeConstant("var1")),
+ ast.makeConstant(15)),
+ ast.makeNode(CAstNode.BINARY_EXPR,
+ CAstOperator.OP_ADD,
+ ast.makeConstant(10),
+ ast.makeNode(CAstNode.VAR, ast.makeConstant("var1"))));
+
+ public static final CAstPattern toCodePattern3 = CAstPattern.parse("BINARY_EXPR(*,\"10\",\"15\")");
+
+ @Test
+ public void testRoot3() {
+ CAstEntity ce = fakeEntity(root3);
+ CAstEntity nce = AstConstantFolder.fold(ce);
+ Collection matches = CAstPattern.findAll(toCodePattern3, nce);
+ assert matches.size() == 1;
+ }
+}
diff --git a/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestNativeTranslator.java b/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestNativeTranslator.java
index 1a6801040..255a4df33 100644
--- a/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestNativeTranslator.java
+++ b/com.ibm.wala.cast.test/harness-src/java/com/ibm/wala/cast/test/TestNativeTranslator.java
@@ -142,6 +142,18 @@ public class TestNativeTranslator {
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public Position getPosition(int arg) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Position getNamePosition() {
+ // TODO Auto-generated method stub
+ return null;
+ }
};
}
}
diff --git a/com.ibm.wala.cast.test/pom.xml b/com.ibm.wala.cast.test/pom.xml
index 43c028825..886e6a4ae 100644
--- a/com.ibm.wala.cast.test/pom.xml
+++ b/com.ibm.wala.cast.test/pom.xml
@@ -5,7 +5,7 @@
com.ibm.wala
WALA
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast.test
eclipse-plugin
@@ -70,7 +70,7 @@
junit
junit
- 4.11
+ 4.12
test
diff --git a/com.ibm.wala.cast/.classpath b/com.ibm.wala.cast/.classpath
deleted file mode 100644
index cd01f6364..000000000
--- a/com.ibm.wala.cast/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast/.cvsignore b/com.ibm.wala.cast/.cvsignore
deleted file mode 100644
index 23f0c70e0..000000000
--- a/com.ibm.wala.cast/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-domo-trace.txt*
diff --git a/com.ibm.wala.cast/.externalToolBuilders/make WALA.CAst.launch b/com.ibm.wala.cast/.externalToolBuilders/make WALA.CAst.launch
deleted file mode 100644
index 9a84baf06..000000000
--- a/com.ibm.wala.cast/.externalToolBuilders/make WALA.CAst.launch
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/com.ibm.wala.cast/.project b/com.ibm.wala.cast/.project
deleted file mode 100644
index a58369e50..000000000
--- a/com.ibm.wala.cast/.project
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
- com.ibm.wala.cast
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
- org.eclipse.ui.externaltools.ExternalToolBuilder
- full,incremental,
-
-
- LaunchConfigHandle
- <project>/.externalToolBuilders/make WALA.CAst.launch
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/com.ibm.wala.cast/.settings/org.eclipse.pde.prefs b/com.ibm.wala.cast/.settings/org.eclipse.pde.prefs
index 4ce1c38b8..8b29c4063 100644
--- a/com.ibm.wala.cast/.settings/org.eclipse.pde.prefs
+++ b/com.ibm.wala.cast/.settings/org.eclipse.pde.prefs
@@ -1,14 +1,14 @@
compilers.f.unresolved-features=0
compilers.f.unresolved-plugins=0
compilers.incompatible-environment=0
-compilers.p.build=0
-compilers.p.build.bin.includes=0
+compilers.p.build=2
+compilers.p.build.bin.includes=2
compilers.p.build.encodings=0
compilers.p.build.java.compiler=0
compilers.p.build.java.compliance=0
compilers.p.build.missing.output=0
-compilers.p.build.output.library=0
-compilers.p.build.source.library=0
+compilers.p.build.output.library=2
+compilers.p.build.source.library=2
compilers.p.build.src.includes=0
compilers.p.deprecated=0
compilers.p.discouraged-class=0
@@ -25,7 +25,7 @@ compilers.p.unknown-element=0
compilers.p.unknown-identifier=0
compilers.p.unknown-resource=0
compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
+compilers.p.unresolved-import=2
compilers.s.create-docs=false
compilers.s.doc-folder=doc
compilers.s.open-tags=0
diff --git a/com.ibm.wala.cast/META-INF/MANIFEST.MF b/com.ibm.wala.cast/META-INF/MANIFEST.MF
index 7409198b8..018ae81bb 100644
--- a/com.ibm.wala.cast/META-INF/MANIFEST.MF
+++ b/com.ibm.wala.cast/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast
-Bundle-Version: 1.4.4.qualifier
+Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.core,
com.ibm.wala.shrike
diff --git a/com.ibm.wala.cast/build.gradle b/com.ibm.wala.cast/build.gradle
new file mode 100644
index 000000000..8b78f1a33
--- /dev/null
+++ b/com.ibm.wala.cast/build.gradle
@@ -0,0 +1,106 @@
+plugins {
+ id 'cpp'
+ id 'eclipse'
+}
+
+eclipse.project.natures 'org.eclipse.pde.PluginNature'
+
+sourceSets.main.java.srcDirs = ['source/java']
+
+dependencies {
+ compile(
+ 'commons-io:commons-io:2.4',
+ project(':com.ibm.wala.core'),
+ project(':com.ibm.wala.shrike'),
+ project(':com.ibm.wala.util'),
+ )
+}
+
+javadoc {
+ def js = ':com.ibm.wala.cast.js'
+ evaluationDependsOn(js)
+
+ dependsOn "$js:compileJava"
+ js = project(js)
+ doFirst {
+ classpath += files js.compileJava
+ }
+
+ dependsOn js.createPackageList
+ options.linksOffline js.javadoc.outputDirectory.path, js.createPackageList.packageList.parent
+}
+
+def currentJavaHome = org.gradle.internal.jvm.Jvm.current().javaHome
+
+model {
+ repositories {
+ libs(PrebuiltLibraries) {
+ jdk {
+ def jniIncludeDir = "$currentJavaHome/include"
+ headers.srcDir jniIncludeDir
+ binaries.withType(SharedLibraryBinary) {
+ switch (targetPlatform.operatingSystem.name) {
+ case 'linux':
+ headers.srcDirs "$jniIncludeDir/linux"
+ def subdirs = ['jre/lib/amd64/server', 'lib/amd64/server', 'lib/server']
+ def candidates = subdirs.collect { file("$currentJavaHome/$it/libjvm.so") }
+ sharedLibraryLinkFile = candidates.find { it.exists() }
+ break
+ case 'osx':
+ headers.srcDirs "$jniIncludeDir/darwin"
+ sharedLibraryLinkFile = file("$currentJavaHome/jre/lib/server/libjvm.dylib")
+ break
+ case 'windows':
+ headers.srcDirs "$jniIncludeDir/win32"
+ sharedLibraryLinkFile = file("$currentJavaHome/lib/jvm.lib")
+ break
+ }
+ }
+ }
+ }
+ }
+
+ components {
+ cast(NativeLibrarySpec) {
+ sources.cpp {
+ def cSourceDir = 'source/c'
+ source {
+ srcDirs = ["$cSourceDir/jni"]
+ include '*.cpp'
+ }
+ exportedHeaders.srcDirs = ["$cSourceDir/include"]
+ lib library: 'jdk'
+ }
+
+ binaries {
+ withType(StaticLibraryBinarySpec) {
+ buildable = false
+ }
+ withType(SharedLibraryBinarySpec) {
+ def libDir = $.repositories['libs'].resolveLibrary('jdk')
+ .binaries.withType(SharedLibraryBinary)
+ .find { it.targetPlatform.name == targetPlatform.name }
+ .sharedLibraryLinkFile.parent
+ linker.args "-Wl,-rpath,$libDir"
+ if (targetPlatform.operatingSystem.name == 'osx') {
+ linker.args "-Wl,-install_name,@rpath/$sharedLibraryFile.name"
+ }
+ }
+ }
+ }
+ }
+}
+
+// TODO: if we eventually stop supporting Maven, then we may be able
+// to discard the "copyJarsIntoLib" task and the corresponding lines
+// in "META-INF/MANIFEST.MF" and "build.properties"
+
+task copyJarsIntoLib(type: Sync) {
+ def commonsIoJar = configurations.runtimeClasspath.files[0]
+ assert commonsIoJar.name.startsWith('commons-io-')
+ from commonsIoJar
+ into 'lib'
+}
+
+assemble.dependsOn copyJarsIntoLib
+clean.dependsOn cleanCopyJarsIntoLib
diff --git a/com.ibm.wala.cast/build.properties b/com.ibm.wala.cast/build.properties
index ab2f2a2a4..85d4cfa7e 100644
--- a/com.ibm.wala.cast/build.properties
+++ b/com.ibm.wala.cast/build.properties
@@ -1,8 +1,7 @@
source.. = source/java/
-output.. = bin/
+output.. = bin/main
bin.includes = META-INF/,\
lib/commons-io-2.4.jar,\
.,\
- OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true
diff --git a/com.ibm.wala.cast/mvncentral.xml b/com.ibm.wala.cast/mvncentral.xml
index f8e8054d9..19e05bfac 100644
--- a/com.ibm.wala.cast/mvncentral.xml
+++ b/com.ibm.wala.cast/mvncentral.xml
@@ -5,7 +5,7 @@
4.0.0
com.ibm.wala
com.ibm.wala.cast
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
jar
WALA CAst
WALA Common AST core library
@@ -45,17 +45,17 @@
com.ibm.wala
com.ibm.wala.util
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.core
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala
com.ibm.wala.shrike
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
commons-io
diff --git a/com.ibm.wala.cast/pom.xml b/com.ibm.wala.cast/pom.xml
index fcad9d334..bc42fa35b 100644
--- a/com.ibm.wala.cast/pom.xml
+++ b/com.ibm.wala.cast/pom.xml
@@ -5,7 +5,7 @@
WALA
com.ibm.wala
- 1.4.4-SNAPSHOT
+ 1.5.1-SNAPSHOT
com.ibm.wala.cast
eclipse-plugin
diff --git a/com.ibm.wala.cast/source/c/.cvsignore b/com.ibm.wala.cast/source/c/.cvsignore
deleted file mode 100644
index 7a72a8bb8..000000000
--- a/com.ibm.wala.cast/source/c/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-CAstWrapper.lib
-CAstWrapper.exp
diff --git a/com.ibm.wala.cast/source/c/include/cast_constants.h b/com.ibm.wala.cast/source/c/include/cast_constants.h
index a06123acf..bf052f6f7 100644
--- a/com.ibm.wala.cast/source/c/include/cast_constants.h
+++ b/com.ibm.wala.cast/source/c/include/cast_constants.h
@@ -87,6 +87,13 @@ _CAstNodeType(IS_DEFINED_EXPR);
_CAstNodeType(INCLUDE)
_CAstNodeType(NAMED_ENTITY_REF);
_CAstNodeType(MACRO_VAR);
+_CAstNodeType(COMPREHENSION_EXPR);
+_CAstNodeType(NEW_ENCLOSING);
+_CAstNodeType(NARY_EXPR);
+_CAstNodeType(SPECIAL_PARENT_SCOPE);
+_CAstNodeType(YIELD_STMT);
+_CAstNodeType(FORIN_LOOP);
+_CAstNodeType(TYPE_LITERAL_EXPR);
#undef _CODE_CONSTANTS
#undef _CPP_CONSTANTS
diff --git a/com.ibm.wala.cast/source/c/jni/CAstWrapper.cpp b/com.ibm.wala.cast/source/c/jni/CAstWrapper.cpp
index 1f4924994..4f33fefa5 100644
--- a/com.ibm.wala.cast/source/c/jni/CAstWrapper.cpp
+++ b/com.ibm.wala.cast/source/c/jni/CAstWrapper.cpp
@@ -1,14 +1,9 @@
-#include
-
-#include
-
-#include
-#include
#include
-
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__APPLE__)
-#define strndup(s,n) strdup(s)
-#endif
+#include
+#include
+#include
+#include
+#include
#define __SIG( __nm ) "L" __nm ";"
@@ -264,16 +259,13 @@ void CAstWrapper::assertIsCAstNode(jobject obj, int n) {
jstring jclsstr = (jstring)env->CallObjectMethod(cls, toString);
const char *cclsstr = env->GetStringUTFChars(jclsstr, NULL);
-#if defined(_MSC_VER)
- char* buf = (char*)_alloca(strlen(cstr) + strlen(cclsstr) + 100);
-#else
- char buf[ strlen(cstr) + strlen(cclsstr) + 100 ];
-#endif
- sprintf(buf, "argument %d (%s of type %s) is not a CAstNode\n", n, cstr, cclsstr);
+ ostringstream formatter;
+ formatter << "argument " << n << " (" << cstr << " of type " << cclsstr << ") is not a CAstNode\n";
+ const string message = formatter.str();
env->ReleaseStringUTFChars(jstr, cstr);
env->ReleaseStringUTFChars(jclsstr, cclsstr);
- THROW(java_ex, buf);
+ THROW(java_ex, message.c_str());
}
}
@@ -417,14 +409,12 @@ jobject CAstWrapper::makeConstant(jobject val) {
return r;
}
-jobject CAstWrapper::makeConstant(const char *strData) {
- return makeConstant(strData, strlen(strData));
+jobject CAstWrapper::makeConstant(const char *strData, int strLen) {
+ return makeConstant(string(strData, strLen).c_str());
}
-jobject CAstWrapper::makeConstant(const char *strData, int strLen) {
- char *safeData = strndup(strData, strLen);
- jobject val = env->NewStringUTF( safeData );
- delete safeData;
+jobject CAstWrapper::makeConstant(const char *strData) {
+ jobject val = env->NewStringUTF( strData );
jobject r = env->CallObjectMethod(Ast, makeObject, val);
THROW_ANY_EXCEPTION(java_ex);
LOG(r);
@@ -588,9 +578,7 @@ const char *CAstWrapper::getEntityName(jobject entity) {
}
jobject CAstWrapper::makeSymbol(const char *name) {
- char *safeName = strndup(name, strlen(name)+1);
- jobject val = env->NewStringUTF( safeName );
- delete safeName;
+ jobject val = env->NewStringUTF( name );
jobject s = env->NewObject(CAstSymbol, castSymbolInit1, val);
THROW_ANY_EXCEPTION(java_ex);
@@ -600,9 +588,7 @@ jobject CAstWrapper::makeSymbol(const char *name) {
}
jobject CAstWrapper::makeSymbol(const char *name, bool isFinal) {
- char *safeName = strndup(name, strlen(name)+1);
- jobject val = env->NewStringUTF( safeName );
- delete safeName;
+ jobject val = env->NewStringUTF( name );
THROW_ANY_EXCEPTION(java_ex);
@@ -614,9 +600,7 @@ jobject CAstWrapper::makeSymbol(const char *name, bool isFinal) {
jobject
CAstWrapper::makeSymbol(const char *name, bool isFinal, bool isCaseInsensitive)
{
- char *safeName = strndup(name, strlen(name)+1);
- jobject val = env->NewStringUTF( safeName );
- delete safeName;
+ jobject val = env->NewStringUTF( name );
jobject s = env->NewObject(CAstSymbol, castSymbolInit3, val, isFinal, isCaseInsensitive);
THROW_ANY_EXCEPTION(java_ex);
@@ -631,9 +615,7 @@ jobject
bool isCaseInsensitive,
jobject defaultValue)
{
- char *safeName = strndup(name, strlen(name)+1);
- jobject val = env->NewStringUTF( safeName );
- delete safeName;
+ jobject val = env->NewStringUTF( name );
jobject s = env->NewObject(CAstSymbol, castSymbolInit4, val, isFinal, isCaseInsensitive, defaultValue);
THROW_ANY_EXCEPTION(java_ex);
@@ -703,10 +685,8 @@ jobject CAstWrapper::makeClassEntity(jobject classType) {
}
jobject CAstWrapper::makeGlobalEntity(char *name, jobject type, list *modifiers) {
- char *safeData = strdup(name);
- jobject val = env->NewStringUTF( safeData );
+ jobject val = env->NewStringUTF( name );
THROW_ANY_EXCEPTION(java_ex);
- delete safeData;
jobject entity = env->NewObject(NativeGlobalEntity, globalEntityInit, val, type, makeSet(modifiers));
THROW_ANY_EXCEPTION(java_ex);
diff --git a/com.ibm.wala.cast/source/c/jni/Exceptions.cpp b/com.ibm.wala.cast/source/c/jni/Exceptions.cpp
index 1f67e660b..63f909db6 100644
--- a/com.ibm.wala.cast/source/c/jni/Exceptions.cpp
+++ b/com.ibm.wala.cast/source/c/jni/Exceptions.cpp
@@ -1,11 +1,12 @@
+#include
#include
-#include
-#include
+#include
+#include
#include "Exceptions.h"
-#ifdef _MSC_VER
-#include
-#endif
+using std::ostringstream;
+using std::string;
+
Exceptions::Exceptions(JNIEnv *java_env, jmp_buf& c_env) :
_java_env(java_env),
@@ -23,14 +24,18 @@ void Exceptions::throwAnyException(const char *file_name, int line_number) {
if (_java_env->ExceptionCheck()) throwException(file_name, line_number);
}
+static void formatExceptionMessage(ostringstream &formatter, const char *file_name, int line_number) {
+ formatter << "exception at " << file_name << ':' << line_number;
+}
+
void Exceptions::throwException(const char *file_name, int line_number) {
jthrowable real_ex = _java_env->ExceptionOccurred();
_java_env->ExceptionClear();
- char msg[strlen(file_name) + 1024];
- memset(msg, 0, strlen(file_name) + 1024);
- sprintf(msg, "exception at %s:%d", file_name, line_number);
- jstring java_message = _java_env->NewStringUTF(msg);
+ ostringstream formatter;
+ formatExceptionMessage(formatter, file_name, line_number);
+ string message = formatter.str();
+ jstring java_message = _java_env->NewStringUTF(message.c_str());
jthrowable ex = (jthrowable)
_java_env->NewObject(_jre, _wrapper_ctr, java_message, real_ex);
@@ -47,10 +52,11 @@ void Exceptions::throwException(const char *file_name, int line_number) {
void
Exceptions::throwException(const char *file_name, int line_number, const char *c_message) {
- char msg[strlen(file_name) + strlen(c_message) + 1024];
- memset(msg, 0, strlen(file_name) + strlen(c_message) + 1024);
- sprintf(msg, "exception at %s:%d: %s", file_name, line_number, c_message);
- jstring java_message = _java_env->NewStringUTF(msg);
+ ostringstream formatter;
+ formatExceptionMessage(formatter, file_name, line_number);
+ formatter << ": " << c_message;
+ string message = formatter.str();
+ jstring java_message = _java_env->NewStringUTF(message.c_str());
jthrowable ex = (jthrowable)_java_env->NewObject(_jre, _ctr, java_message);
_java_env->Throw(ex);
diff --git a/com.ibm.wala.cast/source/c/jni/launch.cpp b/com.ibm.wala.cast/source/c/jni/launch.cpp
index c836a33b1..09be0d7d6 100644
--- a/com.ibm.wala.cast/source/c/jni/launch.cpp
+++ b/com.ibm.wala.cast/source/c/jni/launch.cpp
@@ -1,24 +1,24 @@
-#include
-#include
-#include
+#include
+ #include
+#include
#include "Exceptions.h"
#include "CAstWrapper.h"
#include "launch.h"
JavaVM *javaVM;
+static string javaPathFlag(const string &kind, const char *classpath) {
+ return "-Djava." + kind + ".path=" + classpath;
+}
+
JNIEnv *launch_jvm(char *classpath) {
JavaVMOption jvmopt[2];
- const char *jcp = "-Djava.class.path=";
- char buf_jcp[ strlen(jcp) + strlen(classpath) + 1 ];
- sprintf(buf_jcp, "%s%s", jcp, classpath);
- jvmopt[0].optionString = buf_jcp;
+ string buf_jcp = javaPathFlag("class", classpath);
+ jvmopt[0].optionString = const_cast(buf_jcp.c_str());
- const char *jlp = "-Djava.library.path=";
- char buf_jlp[ strlen(jlp) + strlen(classpath) + 1 ];
- sprintf(buf_jlp, "%s%s", jlp, classpath);
- jvmopt[1].optionString = buf_jlp;
+ string buf_jlp = javaPathFlag("library", classpath);
+ jvmopt[1].optionString = const_cast(buf_jlp.c_str());
JavaVMInitArgs vmArgs;
vmArgs.version = JNI_VERSION_1_8;
@@ -41,3 +41,7 @@ JNIEnv *launch_jvm(char *classpath) {
void kill() {
javaVM->DestroyJavaVM();
}
+
+// Local variables:
+// c-basic-offset: 3
+// End:
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/analysis/typeInference/AstTypeInference.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/analysis/typeInference/AstTypeInference.java
index d6edb1eac..e79faf0de 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/analysis/typeInference/AstTypeInference.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/analysis/typeInference/AstTypeInference.java
@@ -21,6 +21,8 @@ import com.ibm.wala.cast.ir.ssa.AstInstructionVisitor;
import com.ibm.wala.cast.ir.ssa.AstIsDefinedInstruction;
import com.ibm.wala.cast.ir.ssa.AstLexicalRead;
import com.ibm.wala.cast.ir.ssa.AstLexicalWrite;
+import com.ibm.wala.cast.ir.ssa.AstPropertyRead;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
import com.ibm.wala.ssa.IR;
@@ -30,6 +32,15 @@ public abstract class AstTypeInference extends TypeInference {
private final TypeAbstraction booleanType;
protected class AstTypeOperatorFactory extends TypeOperatorFactory implements AstInstructionVisitor {
+ @Override
+ public void visitPropertyRead(AstPropertyRead inst) {
+ result = new DeclaredTypeOperator(new ConeType(cha.getRootClass()));
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite inst) {
+ }
+
@Override
public void visitAstLexicalRead(AstLexicalRead inst) {
result = new DeclaredTypeOperator(new ConeType(cha.getRootClass()));
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/AstSSAPropagationCallGraphBuilder.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/AstSSAPropagationCallGraphBuilder.java
index 8436cd297..c8be04e4f 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/AstSSAPropagationCallGraphBuilder.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/AstSSAPropagationCallGraphBuilder.java
@@ -28,11 +28,14 @@ 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.AstPropertyRead;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
import com.ibm.wala.cast.ir.translator.AstTranslator;
import com.ibm.wala.cast.loader.AstMethod;
import com.ibm.wala.cast.loader.AstMethod.LexicalInformation;
+import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.fixpoint.AbstractOperator;
@@ -64,6 +67,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ipa.modref.ArrayLengthKey;
import com.ibm.wala.ssa.DefUse;
import com.ibm.wala.ssa.IRView;
+import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAPutInstruction;
import com.ibm.wala.ssa.SymbolTable;
import com.ibm.wala.util.collections.HashSetFactory;
@@ -196,6 +200,16 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
super(analysis, lpk);
}
+ @Override
+ public void visitPropertyRead(AstPropertyRead instruction) {
+
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite instruction) {
+
+ }
+
@Override
public void visitAstLexicalRead(AstLexicalRead instruction) {
@@ -260,6 +274,16 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
super(vn);
}
+ @Override
+ public void visitPropertyRead(AstPropertyRead instruction) {
+ bingo = true;
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite instruction) {
+ bingo = true;
+ }
+
@Override
public void visitAstLexicalRead(AstLexicalRead instruction) {
bingo = true;
@@ -367,6 +391,35 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
// }
}
+ @Override
+ public void visitPropertyRead(AstPropertyRead instruction) {
+ if (AstSSAPropagationCallGraphBuilder.DEBUG_PROPERTIES) {
+ Position instructionPosition = getInstructionPosition(instruction);
+ if (instructionPosition != null) {
+ System.err.println("processing read instruction " + instruction + ", position " + instructionPosition);
+ }
+ }
+ newFieldRead(node, instruction.getUse(0), instruction.getUse(1), instruction.getDef(0));
+ }
+
+ private Position getInstructionPosition(SSAInstruction instruction) {
+ IMethod method = node.getMethod();
+ if (method instanceof AstMethod) {
+ return ((AstMethod) method).getSourcePosition(instruction.iindex);
+ }
+ return null;
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite instruction) {
+ if (AstSSAPropagationCallGraphBuilder.DEBUG_PROPERTIES) {
+ Position instructionPosition = getInstructionPosition(instruction);
+ if (instructionPosition != null) {
+ System.err.println("processing write instruction " + instruction + ", position " + instructionPosition);
+ }
+ }
+ newFieldWrite(node, instruction.getUse(0), instruction.getUse(1), instruction.getUse(2));
+ }
@Override
@@ -722,7 +775,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
result.add(x.next());
}
} else {
- Assertions.UNREACHABLE("unexpected instance key " + iKey);
+ //Assertions.UNREACHABLE("unexpected instance key " + iKey);
}
});
}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstCallGraphUtil.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstCallGraphUtil.java
index 0f07f37f0..8c0d567ab 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstCallGraphUtil.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstCallGraphUtil.java
@@ -119,7 +119,7 @@ public class CAstCallGraphUtil {
return result;
}
- public static void dumpCG(SSAContextInterpreter interp, PointerAnalysis PA, CallGraph CG) {
+ public static void dumpCG(SSAContextInterpreter interp, PointerAnalysis extends InstanceKey> PA, CallGraph CG) {
if (AVOID_DUMP)
return;
for (CGNode N : CG) {
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CrossLanguageSSAPropagationCallGraphBuilder.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CrossLanguageSSAPropagationCallGraphBuilder.java
index bb96a3214..793a6129b 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CrossLanguageSSAPropagationCallGraphBuilder.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CrossLanguageSSAPropagationCallGraphBuilder.java
@@ -63,7 +63,7 @@ public abstract class CrossLanguageSSAPropagationCallGraphBuilder extends AstSSA
@Override
protected InterestingVisitor makeInterestingVisitor(CGNode node, int vn) {
- return interesting.get(getLanguage(node), new Integer(vn));
+ return interesting.get(getLanguage(node), Integer.valueOf(vn));
}
@Override
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/DelegatingAstPointerKeys.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/DelegatingAstPointerKeys.java
index 8cffa1e27..40351f009 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/DelegatingAstPointerKeys.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/DelegatingAstPointerKeys.java
@@ -106,8 +106,8 @@ public class DelegatingAstPointerKeys implements AstPointerKeyFactory {
protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey> F) {
Object v = F.getValue();
// FIXME: current only constant string are handled
- if (v instanceof String) {
- IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom((String) v));
+ if (I.getConcreteType().getClassLoader().getLanguage().modelConstant(v)) {
+ IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom(String.valueOf(v)));
return getPointerKeyForInstanceField(I, f);
}
return null;
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/modref/AstModRef.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/modref/AstModRef.java
index 9fe09cb4e..0af83c483 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/modref/AstModRef.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/modref/AstModRef.java
@@ -21,6 +21,8 @@ import com.ibm.wala.cast.ir.ssa.AstInstructionVisitor;
import com.ibm.wala.cast.ir.ssa.AstIsDefinedInstruction;
import com.ibm.wala.cast.ir.ssa.AstLexicalRead;
import com.ibm.wala.cast.ir.ssa.AstLexicalWrite;
+import com.ibm.wala.cast.ir.ssa.AstPropertyRead;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
import com.ibm.wala.ipa.callgraph.CGNode;
@@ -29,6 +31,7 @@ import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
import com.ibm.wala.ipa.modref.ExtendedHeapModel;
import com.ibm.wala.ipa.modref.ModRef;
+import com.ibm.wala.util.collections.Iterator2Iterable;
public class AstModRef extends ModRef {
@@ -43,6 +46,25 @@ public class AstModRef extends ModRef {
super(n, result, pa, h);
}
+ @Override
+ public void visitPropertyRead(AstPropertyRead instruction) {
+ PointerKey obj = h.getPointerKeyForLocal(n, instruction.getObjectRef());
+ PointerKey prop = h.getPointerKeyForLocal(n, instruction.getMemberRef());
+ for(InstanceKey o : pa.getPointsToSet(obj)) {
+ for(InstanceKey p : pa.getPointsToSet(prop)) {
+ for(PointerKey x : Iterator2Iterable.make(h.getPointerKeysForReflectedFieldRead(o, p))) {
+ assert x != null : instruction;
+ result.add(x);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite instruction) {
+ // do nothing
+ }
+
@Override
public void visitAstLexicalRead(AstLexicalRead instruction) {
@@ -147,6 +169,25 @@ public class AstModRef extends ModRef {
public void visitEcho(AstEchoInstruction inst) {
}
+
+ @Override
+ public void visitPropertyRead(AstPropertyRead instruction) {
+ // do nothing
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite instruction) {
+ PointerKey obj = h.getPointerKeyForLocal(n, instruction.getObjectRef());
+ PointerKey prop = h.getPointerKeyForLocal(n, instruction.getMemberRef());
+ for(T o : pa.getPointsToSet(obj)) {
+ for(T p : pa.getPointsToSet(prop)) {
+ for(PointerKey x : Iterator2Iterable.make(h.getPointerKeysForReflectedFieldWrite(o, p))) {
+ assert x != null : instruction;
+ result.add(x);
+ }
+ }
+ }
+ }
}
@Override
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/cfg/AstInducedCFG.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/cfg/AstInducedCFG.java
index e8ff6ebe9..2892c424b 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/cfg/AstInducedCFG.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/cfg/AstInducedCFG.java
@@ -18,6 +18,8 @@ import com.ibm.wala.cast.ir.ssa.AstInstructionVisitor;
import com.ibm.wala.cast.ir.ssa.AstIsDefinedInstruction;
import com.ibm.wala.cast.ir.ssa.AstLexicalRead;
import com.ibm.wala.cast.ir.ssa.AstLexicalWrite;
+import com.ibm.wala.cast.ir.ssa.AstPropertyRead;
+import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
import com.ibm.wala.cfg.InducedCFG;
@@ -37,6 +39,14 @@ public class AstInducedCFG extends InducedCFG {
super(r);
}
+ @Override
+ public void visitPropertyRead(AstPropertyRead inst) {
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite inst) {
+ }
+
@Override
public void visitAstLexicalRead(AstLexicalRead inst) {
}
@@ -85,6 +95,14 @@ public class AstInducedCFG extends InducedCFG {
super(r);
}
+ @Override
+ public void visitPropertyRead(AstPropertyRead inst) {
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite inst) {
+ }
+
@Override
public void visitAstLexicalRead(AstLexicalRead inst) {
}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstAbstractInstructionVisitor.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstAbstractInstructionVisitor.java
index 9fd7b7b00..d0498dcb2 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstAbstractInstructionVisitor.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstAbstractInstructionVisitor.java
@@ -17,6 +17,16 @@ public abstract class AstAbstractInstructionVisitor
implements AstInstructionVisitor
{
+ @Override
+ public void visitPropertyRead(AstPropertyRead instruction) {
+
+ }
+
+ @Override
+ public void visitPropertyWrite(AstPropertyWrite instruction) {
+
+ }
+
@Override
public void visitAstLexicalRead(AstLexicalRead instruction) {
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstConsumeInstruction.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstConsumeInstruction.java
new file mode 100644
index 000000000..9e7e96fd5
--- /dev/null
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstConsumeInstruction.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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 java.util.Collection;
+import java.util.Collections;
+
+import com.ibm.wala.ssa.SSAInstruction;
+import com.ibm.wala.types.TypeReference;
+import com.ibm.wala.util.debug.Assertions;
+
+public abstract class AstConsumeInstruction extends SSAInstruction {
+ protected final int[] rvals;
+
+ public AstConsumeInstruction(int iindex, int[] rvals) {
+ super(iindex);
+ this.rvals = rvals;
+ }
+
+ @Override
+ public int getNumberOfDefs() {
+ return 0;
+ }
+
+ @Override
+ public int getDef(int i) {
+ Assertions.UNREACHABLE();
+ return -1;
+ }
+
+ @Override
+ public int getNumberOfUses() {
+ return rvals.length;
+ }
+
+ @Override
+ public int getUse(int i) {
+ return rvals[i];
+ }
+
+ @Override
+ public int hashCode() {
+ int v = 1;
+ for (int rval : rvals) {
+ v *= rval;
+ }
+
+ return v;
+ }
+
+ @Override
+ public boolean isFallThrough() {
+ return true;
+ }
+
+ @Override
+ public Collection getExceptionTypes() {
+ return Collections.emptySet();
+ }
+
+}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstEchoInstruction.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstEchoInstruction.java
index e36e136e3..cd59b8413 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstEchoInstruction.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstEchoInstruction.java
@@ -10,21 +10,14 @@
*******************************************************************************/
package com.ibm.wala.cast.ir.ssa;
-import java.util.Collection;
-import java.util.Collections;
-
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAInstructionFactory;
import com.ibm.wala.ssa.SymbolTable;
-import com.ibm.wala.types.TypeReference;
-import com.ibm.wala.util.debug.Assertions;
-public class AstEchoInstruction extends SSAInstruction {
- private final int[] rvals;
+public class AstEchoInstruction extends AstConsumeInstruction {
public AstEchoInstruction(int iindex, int[] rvals) {
- super(iindex);
- this.rvals = rvals;
+ super(iindex, rvals);
}
@Override
@@ -32,36 +25,6 @@ public class AstEchoInstruction extends SSAInstruction {
return ((AstInstructionFactory)insts).EchoInstruction(iindex, uses==null? rvals: uses);
}
- @Override
- public int getNumberOfDefs() {
- return 0;
- }
-
- @Override
- public int getDef(int i) {
- Assertions.UNREACHABLE();
- return -1;
- }
-
- @Override
- public int getNumberOfUses() {
- return rvals.length;
- }
-
- @Override
- public int getUse(int i) {
- return rvals[i];
- }
-
- @Override
- public int hashCode() {
- int v = 1;
- for (int rval : rvals) {
- v *= rval;
- }
-
- return v;
- }
@Override
public String toString(SymbolTable symbolTable) {
@@ -78,14 +41,5 @@ public class AstEchoInstruction extends SSAInstruction {
((AstInstructionVisitor)v).visitEcho(this);
}
- @Override
- public boolean isFallThrough() {
- return true;
- }
-
- @Override
- public Collection getExceptionTypes() {
- return Collections.emptySet();
- }
}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstIRFactory.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstIRFactory.java
index 9da35df4b..524da1efc 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstIRFactory.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstIRFactory.java
@@ -13,6 +13,7 @@ package com.ibm.wala.cast.ir.ssa;
import java.util.Map;
import java.util.Map.Entry;
+import com.ibm.wala.cast.ir.ssa.SSAConversion.SSAInformation;
import com.ibm.wala.cast.loader.AstMethod;
import com.ibm.wala.cast.loader.AstMethod.LexicalInformation;
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
@@ -73,7 +74,7 @@ public class AstIRFactory implements IRFactory {
public static class AstIR extends IR {
private final LexicalInformation lexicalInfo;
- private final SSA2LocalMap localMap;
+ private final SSAConversion.SSAInformation localMap;
public LexicalInformation lexicalInfo() {
return lexicalInfo;
@@ -100,7 +101,7 @@ public class AstIRFactory implements IRFactory {
}
@Override
- protected SSA2LocalMap getLocalMap() {
+ public SSAInformation getLocalMap() {
return localMap;
}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionFactory.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionFactory.java
index f4ea9e436..99687678e 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionFactory.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionFactory.java
@@ -51,4 +51,10 @@ public interface AstInstructionFactory extends SSAInstructionFactory {
EachElementHasNextInstruction EachElementHasNextInstruction(int iindex, int lValue, int objectRef, int previousProp);
+ AstPropertyRead PropertyRead(int iindex, int result, int objectRef, int memberRef);
+
+ AstPropertyWrite PropertyWrite(int iindex, int objectRef, int memberRef, int value);
+
+ AstYieldInstruction YieldInstruction(int iindex, int[] rvals);
+
}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionVisitor.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionVisitor.java
index da6580178..8b5884d02 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionVisitor.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionVisitor.java
@@ -12,24 +12,32 @@ package com.ibm.wala.cast.ir.ssa;
import com.ibm.wala.ssa.SSAInstruction;
+@SuppressWarnings("unused")
public interface AstInstructionVisitor extends SSAInstruction.IVisitor {
- public void visitAstLexicalRead(AstLexicalRead instruction);
+ default void visitAstLexicalRead(AstLexicalRead instruction){ }
- public void visitAstLexicalWrite(AstLexicalWrite instruction);
+ default void visitAstLexicalWrite(AstLexicalWrite instruction){ }
- public void visitAstGlobalRead(AstGlobalRead instruction);
+ default void visitAstGlobalRead(AstGlobalRead instruction){ }
- public void visitAstGlobalWrite(AstGlobalWrite instruction);
+ default void visitAstGlobalWrite(AstGlobalWrite instruction){ }
- public void visitAssert(AstAssertInstruction instruction);
+ default void visitAssert(AstAssertInstruction instruction){ }
- public void visitEachElementGet(EachElementGetInstruction inst);
+ default void visitEachElementGet(EachElementGetInstruction inst){ }
- public void visitEachElementHasNext(EachElementHasNextInstruction inst);
+ default void visitEachElementHasNext(EachElementHasNextInstruction inst){ }
- public void visitIsDefined(AstIsDefinedInstruction inst);
+ default void visitIsDefined(AstIsDefinedInstruction inst){ }
- public void visitEcho(AstEchoInstruction inst);
+ default void visitEcho(AstEchoInstruction inst){ }
+
+ default void visitYield(AstYieldInstruction inst){ }
+
+ default void visitPropertyRead(AstPropertyRead instruction){ }
+
+ default void visitPropertyWrite(AstPropertyWrite instruction){ }
+
}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstPropertyRead.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstPropertyRead.java
new file mode 100644
index 000000000..3a5a826e8
--- /dev/null
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstPropertyRead.java
@@ -0,0 +1,36 @@
+package com.ibm.wala.cast.ir.ssa;
+
+import com.ibm.wala.ssa.SSAInstruction;
+import com.ibm.wala.ssa.SSAInstructionFactory;
+
+public abstract class AstPropertyRead extends AbstractReflectiveGet {
+
+ public AstPropertyRead(int iindex, int result, int objectRef, int memberRef) {
+ super(iindex, result, objectRef, memberRef);
+ }
+
+ @Override
+ public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
+ return
+ ((AstInstructionFactory)insts).PropertyRead(iindex,
+ defs==null? getDef(): defs[0],
+ uses==null? getObjectRef(): uses[0],
+ uses==null? getMemberRef(): uses[1]);
+ }
+
+ @Override
+ public boolean isPEI() {
+ return true;
+ }
+
+ /**
+ /* (non-Javadoc)
+ * @see com.ibm.wala.ssa.SSAInstruction#visit(com.ibm.wala.ssa.SSAInstruction.IVisitor)
+ */
+ @Override
+ public void visit(IVisitor v) {
+ assert v instanceof AstInstructionVisitor;
+ ((AstInstructionVisitor)v).visitPropertyRead(this);
+ }
+
+}
\ No newline at end of file
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstPropertyWrite.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstPropertyWrite.java
new file mode 100644
index 000000000..89a4ef954
--- /dev/null
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstPropertyWrite.java
@@ -0,0 +1,38 @@
+package com.ibm.wala.cast.ir.ssa;
+
+import com.ibm.wala.ssa.SSAInstruction;
+import com.ibm.wala.ssa.SSAInstructionFactory;
+import com.ibm.wala.ssa.SymbolTable;
+
+public abstract class AstPropertyWrite extends AbstractReflectivePut {
+
+ public AstPropertyWrite(int iindex, int objectRef, int memberRef, int value) {
+ super(iindex, objectRef, memberRef, value);
+ }
+
+ @Override
+ public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
+ return ((AstInstructionFactory)insts).PropertyWrite(iindex, uses == null ? getObjectRef() : uses[0], uses == null ? getMemberRef() : uses[1],
+ uses == null ? getValue() : uses[2]);
+ }
+
+ @Override
+ public String toString(SymbolTable symbolTable) {
+ return super.toString(symbolTable) + " = " + getValueString(symbolTable, getValue());
+ }
+
+ /**
+ * @see com.ibm.wala.ssa.SSAInstruction#visit(IVisitor)
+ */
+ @Override
+ public void visit(IVisitor v) {
+ assert v instanceof AstInstructionVisitor;
+ ((AstInstructionVisitor) v).visitPropertyWrite(this);
+ }
+
+ @Override
+ public boolean isPEI() {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstYieldInstruction.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstYieldInstruction.java
new file mode 100644
index 000000000..4d20621ee
--- /dev/null
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstYieldInstruction.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ssa.SSAInstruction;
+import com.ibm.wala.ssa.SSAInstructionFactory;
+import com.ibm.wala.ssa.SymbolTable;
+
+public class AstYieldInstruction extends AstConsumeInstruction {
+
+ public AstYieldInstruction(int iindex, int[] rvals) {
+ super(iindex, rvals);
+ }
+
+ @Override
+ public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
+ return ((AstInstructionFactory)insts).EchoInstruction(iindex, uses==null? rvals: uses);
+ }
+
+
+ @Override
+ public String toString(SymbolTable symbolTable) {
+ StringBuffer result = new StringBuffer("echo/print ");
+ for (int rval : rvals) {
+ result.append(getValueString(symbolTable, rval)).append(" ");
+ }
+
+ return result.toString();
+ }
+
+ @Override
+ public void visit(IVisitor v) {
+ ((AstInstructionVisitor)v).visitYield(this);
+ }
+
+}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/EachElementGetInstruction.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/EachElementGetInstruction.java
index a865a838f..edf19a9f2 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/EachElementGetInstruction.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/EachElementGetInstruction.java
@@ -59,4 +59,10 @@ public class EachElementGetInstruction extends SSAAbstractBinaryInstruction {
public boolean isFallThrough() {
return true;
}
+
+ @Override
+ public boolean isPEI() {
+ return true;
+ }
+
}
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/FixedParametersInvokeInstruction.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/FixedParametersInvokeInstruction.java
index 4227a921a..d201dbfd9 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/FixedParametersInvokeInstruction.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/FixedParametersInvokeInstruction.java
@@ -89,7 +89,7 @@ public abstract class FixedParametersInvokeInstruction
}
@Override
- public int getNumberOfParameters() {
+ public int getNumberOfPositionalParameters() {
if (params == null) {
return 0;
} else {
@@ -107,7 +107,7 @@ public abstract class FixedParametersInvokeInstruction
@Override
public int getNumberOfUses() {
- return getNumberOfParameters();
+ return getNumberOfPositionalParameters();
}
@Override
@@ -119,7 +119,7 @@ public abstract class FixedParametersInvokeInstruction
@Override
public int getUse(int j) {
- if (j < getNumberOfParameters())
+ if (j < getNumberOfPositionalParameters())
return params[j];
else {
return super.getUse(j);
diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/SSAConversion.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/SSAConversion.java
index 7ed877ad6..19ce23934 100644
--- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/SSAConversion.java
+++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/SSAConversion.java
@@ -12,7 +12,6 @@ package com.ibm.wala.cast.ir.ssa;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -20,7 +19,6 @@ import com.ibm.wala.cast.ir.ssa.analysis.LiveAnalysis;
import com.ibm.wala.cast.loader.AstMethod;
import com.ibm.wala.cast.loader.AstMethod.DebuggingInformation;
import com.ibm.wala.cast.loader.AstMethod.LexicalInformation;
-import com.ibm.wala.ssa.IR.SSA2LocalMap;
import com.ibm.wala.ssa.SSACFG;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAOptions;
@@ -62,7 +60,7 @@ public class SSAConversion extends AbstractSSAConversion {
private final LiveAnalysis.Result liveness;
- private SSA2LocalMap computedLocalMap;
+ private SSAInformation computedLocalMap;
private Map assignments = HashMapFactory.make();
@@ -74,11 +72,19 @@ public class SSAConversion extends AbstractSSAConversion {
private final ArrayList R[];
- private static class UseRecord {
+ public static class UseRecord {
final int instructionIndex;
final int useNumber;
+ public int getInstructionIndex() {
+ return instructionIndex;
+ }
+
+ public int getUseNumber() {
+ return useNumber;
+ }
+
private UseRecord(int instructionIndex, int useNumber) {
this.useNumber = useNumber;
this.instructionIndex = instructionIndex;
@@ -101,7 +107,7 @@ public class SSAConversion extends AbstractSSAConversion {
}
}
- private class PhiUseRecord {
+ public class PhiUseRecord {
final int BBnumber;
final int phiNumber;
@@ -114,6 +120,18 @@ public class SSAConversion extends AbstractSSAConversion {
this.useNumber = useNumber;
}
+ public int getBBnumber() {
+ return BBnumber;
+ }
+
+ public int getPhiNumber() {
+ return phiNumber;
+ }
+
+ public int getUseNumber() {
+ return useNumber;
+ }
+
@Override
public String toString() {
return "[use " + useNumber + " of " + phiNumber + " of block " + BBnumber + "]";
@@ -131,7 +149,7 @@ public class SSAConversion extends AbstractSSAConversion {
}
}
- private class CopyPropagationRecord {
+ public class CopyPropagationRecord {
final int rhs;
final int instructionIndex;
@@ -140,6 +158,22 @@ public class SSAConversion extends AbstractSSAConversion {
private final Set childRecords = HashSetFactory.make(1);
+ public int getRhs() {
+ return rhs;
+ }
+
+ public int getInstructionIndex() {
+ return instructionIndex;
+ }
+
+ public Set