Compare commits

..

23 Commits

Author SHA1 Message Date
Michael Herzberg 39b3cad56a For some reason, using the precise JS call graph builder, the analysis crashes here.... Temporary workaround. 2015-08-17 19:18:26 +02:00
Michael Herzberg 345acb559f Changed visibility of getCol function. 2015-08-03 16:18:15 +02:00
Michael Herzberg 1e78b289e1 Cleaned up. 2015-07-19 22:21:37 +02:00
Michael Herzberg bc50020c61 Readded column information. 2015-07-19 20:43:08 +02:00
Michael Herzberg fdb25cb7ed Added catching of StringIndexOutOfBoundExceptions. 2015-07-19 15:43:36 +02:00
Michael Herzberg 5c061b7462 Added missing jars back to build.properties and removed sample cup download which is not available anymore. 2015-07-19 13:57:38 +02:00
Michael Herzberg 2996a704e3 Changed some pom.xmls and build.properties to use maven dependencies for some and put the class files not in nested jars but on the top level. 2015-07-08 13:03:03 +02:00
Michael Herzberg ab33d777fc Removed @Override to support older eclipse versions. 2015-07-08 12:56:39 +02:00
Michael Herzberg 69a671680d Fixed quotifying of JavaScript elements. 2015-07-08 12:56:04 +02:00
Michael Herzberg 6a8bcdacfb Added possibility to add dex line number information manually. 2015-07-02 20:37:51 +02:00
Michael Herzberg 8f247b7fa6 Added missing method when using Eclipse Mars. 2015-07-01 13:30:09 +02:00
Michael Herzberg d1010ff939 Changed visibility of getScriptFromUrl in order to be able to override it. 2015-07-01 13:29:27 +02:00
Michael Herzberg b620ae4c1d Muted logging of timings. 2015-06-24 15:00:28 +02:00
Michael Herzberg 50dbbba070 Close input streams properly. 2015-06-24 14:07:55 +02:00
Michael Herzberg 6961dd9a08 Made call graph builder less noisy. 2015-06-24 14:07:29 +02:00
Michael Herzberg 842ce920e7 Use IOUtils instead of FileUtils to allow reading of files from jars. 2015-06-24 02:27:56 +02:00
Michael Herzberg 2e592889c8 Added corner case when line = 1. 2015-06-24 01:44:07 +02:00
Michael Herzberg 6d20fc80cd Implemented line and column information for JavaScript code. 2015-06-21 15:34:55 +02:00
Michael Herzberg 4767929b66 (Hopefully) Fixed construction of dalvik goto instructions. 2015-06-21 15:25:32 +02:00
Michael Herzberg 42e5ec14e6 Ignore script tags in HTML files which are not JavaScript. 2015-06-21 15:22:39 +02:00
Michael Herzberg dbe76a5145 Moved event listener models from prototype into function. 2015-06-21 14:26:21 +02:00
Michael Herzberg 2cec69074c Changed buildCG method to be static. 2015-06-21 14:15:06 +02:00
Michael Herzberg 3db294742e Changed build.xml to copy dx.jar from ANDROID_HOME. 2015-06-21 13:05:57 +02:00
1940 changed files with 25209 additions and 41284 deletions

View File

@ -1,6 +0,0 @@
((groovy-mode
(c-file-style . "bsd")))
;; Local variables:
;; flycheck-disabled-checkers: (emacs-lisp emacs-lisp-checkdoc)
;; End:

75
.gitignore vendored
View File

@ -4,48 +4,39 @@
*.swp
*/bin/
*/bin/*
*/build/
*~
.classpath
.metadata/
.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
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.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.test/test.jar
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/
target/
.classpath
.project

6
.idea/.gitignore vendored
View File

@ -1,6 +0,0 @@
*.iml
/libraries/*.xml
/modules.xml
/tasks.xml
/usage.statistics.xml
/workspace.xml

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/buildSrc" />
<option value="$PROJECT_DIR$/com.ibm.wala-repository" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.java" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.java.ecj" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.java.test" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.java.test.data" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.js" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.js.html.nu_validator" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.js.nodejs" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.js.nodejs.test" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.js.rhino" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.js.rhino.test" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.js.test" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.js.test.data" />
<option value="$PROJECT_DIR$/com.ibm.wala.cast.test" />
<option value="$PROJECT_DIR$/com.ibm.wala.core" />
<option value="$PROJECT_DIR$/com.ibm.wala.core.testdata" />
<option value="$PROJECT_DIR$/com.ibm.wala.core.tests" />
<option value="$PROJECT_DIR$/com.ibm.wala.dalvik" />
<option value="$PROJECT_DIR$/com.ibm.wala.dalvik.test" />
<option value="$PROJECT_DIR$/com.ibm.wala.ide" />
<option value="$PROJECT_DIR$/com.ibm.wala.ide.jdt" />
<option value="$PROJECT_DIR$/com.ibm.wala.ide.jdt.test" />
<option value="$PROJECT_DIR$/com.ibm.wala.ide.jsdt" />
<option value="$PROJECT_DIR$/com.ibm.wala.ide.jsdt.tests" />
<option value="$PROJECT_DIR$/com.ibm.wala.ide.tests" />
<option value="$PROJECT_DIR$/com.ibm.wala.ide_feature" />
<option value="$PROJECT_DIR$/com.ibm.wala.scandroid" />
<option value="$PROJECT_DIR$/com.ibm.wala.shrike" />
<option value="$PROJECT_DIR$/com.ibm.wala.tests.ide_feature" />
<option value="$PROJECT_DIR$/com.ibm.wala.tests_feature" />
<option value="$PROJECT_DIR$/com.ibm.wala.util" />
<option value="$PROJECT_DIR$/com.ibm.wala_feature" />
</set>
</option>
<option name="useAutoImport" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="Java 1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,20 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="After Opening Pristine Project" type="GradleRunConfiguration" factoryName="Gradle" singleton="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="prepareIntelliJIDEA" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method />
</configuration>
</component>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,321 +1,18 @@
sudo: false
android:
components:
- build-tools-26.0.2
addons:
apt:
packages:
- realpath
- xvfb
language: android
jdk: oraclejdk8
before_install:
- 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"
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "pushd /tmp"
- "git clone https://github.com/secure-software-engineering/DroidBench.git"
- "popd"
- "mkdir -p $TRAVIS_BUILD_DIR/com.ibm.wala.dalvik.test/lib"
- "find /usr/local -name dx.jar -exec cp '{}' $TRAVIS_BUILD_DIR/com.ibm.wala.dalvik.test/lib/dx.jar ';'"
install: mvn clean verify -DskipTests=true -B -q
script: mvn clean verify -B -q
sudo: false
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"
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
- $HOME/.m2
- $TRAVIS_BUILD_DIR/com.ibm.wala.core.testdata/ocaml/ocamljava-2.0-alpha1/lib

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.buildship.core.launch.runconfiguration">
<listAttribute key="arguments"/>
<booleanAttribute key="build_scans_enabled" value="false"/>
<stringAttribute key="gradle_distribution" value="GRADLE_DISTRIBUTION(WRAPPER)"/>
<stringAttribute key="gradle_user_home" value=""/>
<listAttribute key="jvm_arguments"/>
<booleanAttribute key="offline_mode" value="false"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<booleanAttribute key="override_workspace_settings" value="false"/>
<booleanAttribute key="show_console_view" value="true"/>
<booleanAttribute key="show_execution_view" value="true"/>
<listAttribute key="tasks">
<listEntry value="afterEclipseBuildshipImport"/>
</listAttribute>
<stringAttribute key="working_dir" value="${workspace_loc:/com.ibm.wala}"/>
</launchConfiguration>

277
LICENSE
View File

@ -1,277 +0,0 @@
Eclipse Public License - v 2.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial content
Distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from
and are Distributed by that particular Contributor. A Contribution
"originates" from a Contributor if it was added to the Program by
such Contributor itself or anyone acting on such Contributor's behalf.
Contributions do not include changes or additions to the Program that
are not Modified Works.
"Contributor" means any person or entity that Distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which
are necessarily infringed by the use or sale of its Contribution alone
or when combined with the Program.
"Program" means the Contributions Distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement
or any Secondary License (as applicable), including Contributors.
"Derivative Works" shall mean any work, whether in Source Code or other
form, that is based on (or derived from) the Program and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship.
"Modified Works" shall mean any work in Source Code or other form that
results from an addition to, deletion from, or modification of the
contents of the Program, including, for purposes of clarity any new file
in Source Code form that contains any contents of the Program. Modified
Works shall not include works that contain only declarations,
interfaces, types, classes, structures, or files of the Program solely
in each case in order to link to, bind by name, or subclass the Program
or Modified Works thereof.
"Distribute" means the acts of a) distributing or b) making available
in any manner that enables the transfer of a copy.
"Source Code" means the form of a Program preferred for making
modifications, including but not limited to software source code,
documentation source, and configuration files.
"Secondary License" means either the GNU General Public License,
Version 2.0, or any later versions of that license, including any
exceptions or additional permissions as identified by the initial
Contributor.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free copyright
license to reproduce, prepare Derivative Works of, publicly display,
publicly perform, Distribute and sublicense the Contribution of such
Contributor, if any, and such Derivative Works.
b) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free patent
license under Licensed Patents to make, use, sell, offer to sell,
import and otherwise transfer the Contribution of such Contributor,
if any, in Source Code or other form. This patent license shall
apply to the combination of the Contribution and the Program if, at
the time the Contribution is added by the Contributor, such addition
of the Contribution causes such combination to be covered by the
Licensed Patents. The patent license shall not apply to any other
combinations which include the Contribution. No hardware per se is
licensed hereunder.
c) Recipient understands that although each Contributor grants the
licenses to its Contributions set forth herein, no assurances are
provided by any Contributor that the Program does not infringe the
patent or other intellectual property rights of any other entity.
Each Contributor disclaims any liability to Recipient for claims
brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the
rights and licenses granted hereunder, each Recipient hereby
assumes sole responsibility to secure any other intellectual
property rights needed, if any. For example, if a third party
patent license is required to allow Recipient to Distribute the
Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
d) Each Contributor represents that to its knowledge it has
sufficient copyright rights in its Contribution, if any, to grant
the copyright license set forth in this Agreement.
e) Notwithstanding the terms of any Secondary License, no
Contributor makes additional grants to any Recipient (other than
those set forth in this Agreement) as a result of such Recipient's
receipt of the Program under the terms of a Secondary License
(if permitted under the terms of Section 3).
3. REQUIREMENTS
3.1 If a Contributor Distributes the Program in any form, then:
a) the Program must also be made available as Source Code, in
accordance with section 3.2, and the Contributor must accompany
the Program with a statement that the Source Code for the Program
is available under this Agreement, and informs Recipients how to
obtain it in a reasonable manner on or through a medium customarily
used for software exchange; and
b) the Contributor may Distribute the Program under a license
different than this Agreement, provided that such license:
i) effectively disclaims on behalf of all other Contributors all
warranties and conditions, express and implied, including
warranties or conditions of title and non-infringement, and
implied warranties or conditions of merchantability and fitness
for a particular purpose;
ii) effectively excludes on behalf of all other Contributors all
liability for damages, including direct, indirect, special,
incidental and consequential damages, such as lost profits;
iii) does not attempt to limit or alter the recipients' rights
in the Source Code under section 3.2; and
iv) requires any subsequent distribution of the Program by any
party to be under a license that satisfies the requirements
of this section 3.
3.2 When the Program is Distributed as Source Code:
a) it must be made available under this Agreement, or if the
Program (i) is combined with other material in a separate file or
files made available under a Secondary License, and (ii) the initial
Contributor attached to the Source Code the notice described in
Exhibit A of this Agreement, then the Program may be made available
under the terms of such Secondary Licenses, and
b) a copy of this Agreement must be included with each copy of
the Program.
3.3 Contributors may not remove or alter any copyright, patent,
trademark, attribution notices, disclaimers of warranty, or limitations
of liability ("notices") contained within the Program from any copy of
the Program which they Distribute, provided that Contributors may add
their own appropriate notices.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities
with respect to end users, business partners and the like. While this
license is intended to facilitate the commercial use of the Program,
the Contributor who includes the Program in a commercial product
offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes
the Program in a commercial product offering, such Contributor
("Commercial Contributor") hereby agrees to defend and indemnify every
other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits
and other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such
Commercial Contributor in connection with its distribution of the Program
in a commercial product offering. The obligations in this section do not
apply to any claims or Losses relating to any actual or alleged
intellectual property infringement. In order to qualify, an Indemnified
Contributor must: a) promptly notify the Commercial Contributor in
writing of such claim, and b) allow the Commercial Contributor to control,
and cooperate with the Commercial Contributor in, the defense and any
related settlement negotiations. The Indemnified Contributor may
participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial
product offering, Product X. That Contributor is then a Commercial
Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance
claims and warranties are such Commercial Contributor's responsibility
alone. Under this section, the Commercial Contributor would have to
defend claims against the other Contributors related to those performance
claims and warranties, and if a court requires any other Contributor to
pay any damages as a result, the Commercial Contributor must pay
those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. Each Recipient is solely responsible for determining the
appropriateness of using and distributing the Program and assumes all
risks associated with its exercise of rights under this Agreement,
including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs
or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this Agreement, and without further
action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that the
Program itself (excluding combinations of the Program with other software
or hardware) infringes such Recipient's patent(s), then such Recipient's
rights granted under Section 2(b) shall terminate as of the date such
litigation is filed.
All Recipient's rights under this Agreement shall terminate if it
fails to comply with any of the material terms or conditions of this
Agreement and does not cure such failure in a reasonable period of
time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use
and distribution of the Program as soon as reasonably practicable.
However, Recipient's obligations under this Agreement and any licenses
granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement,
but in order to avoid inconsistency the Agreement is copyrighted and
may only be modified in the following manner. The Agreement Steward
reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement
Steward has the right to modify this Agreement. The Eclipse Foundation
is the initial Agreement Steward. The Eclipse Foundation may assign the
responsibility to serve as the Agreement Steward to a suitable separate
entity. Each new version of the Agreement will be given a distinguishing
version number. The Program (including Contributions) may always be
Distributed subject to the version of the Agreement under which it was
received. In addition, after a new version of the Agreement is published,
Contributor may elect to Distribute the Program (including its
Contributions) under the new version.
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
receives no rights or licenses to the intellectual property of any
Contributor under this Agreement, whether expressly, by implication,
estoppel or otherwise. All rights in the Program not expressly granted
under this Agreement are reserved. Nothing in this Agreement is intended
to be enforceable by any entity that is not a Contributor or Recipient.
No third-party beneficiary rights are created under this Agreement.
Exhibit A - Form of Secondary Licenses Notice
"This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set forth
in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
version(s), and exceptions or additional permissions here}."
Simply including a copy of this Agreement, including this Exhibit A
is not sufficient to license the Source Code under Secondary Licenses.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to
look for such a notice.
You may add additional accurate notices of copyright ownership.

View File

@ -1,340 +0,0 @@
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.
<a id="comprehensive-external-dependencies"/>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 WALAs 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 WALAs 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 [Gradles `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 IDEAs 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 WALAs 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 WALAs main (non-test) code
- `build`: build all WALA code and run all automated tests
- `javadoc`: build all Javadoc documentation
- `publishToMavenLocal`: install WALAs 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 Gradles 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 Eclipses 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
Gradles [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.
<a id="travis-ci-macos"/>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.
<!--
LocalWords: processTestResources pre classpath gradlew mvn
LocalWords: javadoc buildship issuecomment
-->

View File

@ -1,82 +1 @@
# WALA for DASCA
This is a fork of WALA, tracking minor bug-fixes and enhancements required for
[DASCA](https://git.logicalhacking.com/DASCA/DASCA).
## Integrating Updates from Upstream
After cloning the repostistory, you need to manually configure the upstream URL
of the remote fork:
``` sh
git remote add upstream https://github.com/wala/WALA.git
```
The default steps for merging with upstream are:
``` sh
git fetch upstream
git checkout master
git merge upstream/master
```
## Building Artifacts
This fork uses the gradle setup of the WALA build system. Thus, for details, please
consult the instructions in the file [README-Gradle](README-Gradle.md). In general,
for rebuilding all WALA artifacts, use:
``` sh
./gradlew clean assemble
```
## Publishing Artifacts
### Configuration
For publishing artifacts, you need to configure the username and password required
for uploading to the remote artifacts repository, i.e., you need to add the following
properties to your `GRADLE_USER_HOME/gradle.properties` (default: `$HOME/.gradle/gradle.properties`)
file:
``` gradle
comLogicalhackingArtifactsUser=<USER>
comLogicalhackingArtifactsPassword=<PASSWORD>
```
### Preparation
Before publishing new artifacts to the artifacts repository, please update the version identifier in the file `build.gradle` by removing the `SNAPSHOT` postfix
and updating the `<WALAVERSION>` identifier.
``` gradle
version '<WALAVERSION>.[R|S].DASCA.<DASCAVERSION>'
```
with the version that should be published. Next, commit your changes and tag the
new version:
``` gradle
git commit -m "Preparing release of version <VERSION>." build.gradle
git tag -s "<VERSION>" -m "Tagging version <VERSION>."
```
Finally, mark the development version by appending `-SNAPSHOT`
``` gradle
version '<WALAVERSION>.[R|S].DASCA.<DASCAVERSION>-SNAPSHOT'
```
and commit your changes:
``` gradle
git commit -m "Marked development version" build.gradle
```
### Uploading Artifacts
Publishing artifacts is as easy as calling
``` sh
./gradlew publish
```
This is a fork of WALA, tracking minor bug-fixes and enhancements required for DASCA.

View File

@ -1,25 +0,0 @@
os: Visual Studio 2015
install:
- ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\maven" )) {
(new-object System.Net.WebClient).DownloadFile(
'http://www.us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip',
'C:\maven-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven")
}
- cmd: SET PATH=C:\maven\apache-maven-3.3.9\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET MAVEN_OPTS=-XX:MaxPermSize=2g -Xmx4g
- cmd: SET JAVA_OPTS=-XX:MaxPermSize=2g -Xmx4g
build_script:
- mvn clean verify -DskipTests=true -B -q
test_script:
- mvn clean verify -B -q
cache:
- C:\maven\
- C:\Users\appveyor\.m2

View File

@ -1,42 +0,0 @@
#!/usr/bin/env python
# script to build jars for maven central
import sys
import subprocess
import os
# action should be either 'install' (for local test)
# or 'deploy' (for deployment to maven central).
# if current version is SNAPSHOT, will only be deployed
# to sonatype's staging servers. otherwise, will be
# deployed to maven central
action = sys.argv[1]
# projects for which we should build jars, in order
# will be prefixed with 'com.ibm.wala.'
projects = [
"util",
"shrike",
"core",
"cast",
"cast.java",
"cast.java.ecj",
"cast.js",
"cast.js.rhino",
"dalvik",
"scandroid"
]
for proj in projects:
full_proj = "com.ibm.wala." + 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)
raise
os.chdir("..")

View File

@ -1,196 +0,0 @@
////////////////////////////////////////////////////////////////////////
//
// 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.S.DASCA.1.0.0-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
}
}
publishing {
repositories {
maven {
url = "sftp://artifacts.logicalhacking.com:22/home/brucker/www/artifacts.logicalhacking.com/htdocs/maven3/"
credentials {
username comLogicalhackingArtifactsUser
password comLogicalhackingArtifactsPassword
}
}
}
}
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 <https://github.com/gradle/gradle/issues/4802>
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
}
}
}

1
buildSrc/.gitignore vendored
View File

@ -1 +0,0 @@
/.gradle/

View File

@ -1,7 +0,0 @@
repositories {
mavenCentral()
}
dependencies {
compile 'de.undercouch:gradle-download-task:3.4.3'
}

View File

@ -1,31 +0,0 @@
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"
}
}
}

View File

@ -1,53 +0,0 @@
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
}
}
}

View File

@ -5,10 +5,6 @@
import sys
import subprocess
def runAndPrint(cmd):
print cmd
subprocess.check_output(cmd, shell=True)
oldVersion = sys.argv[1]
newVersion = sys.argv[2]
@ -17,11 +13,13 @@ print oldVersion + " --> " + newVersion
oldVersion = oldVersion.replace(".", "\.")
newVersion = newVersion.replace(".", "\.")
runAndPrint("mvn clean -q")
cleanCmd = "mvn clean -q"
print cleanCmd
subprocess.check_output(cleanCmd, 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")
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)
oldIsSnapshot = oldVersion.endswith("SNAPSHOT")
newIsSnapShot = newVersion.endswith("SNAPSHOT")
@ -29,7 +27,10 @@ newIsSnapShot = newVersion.endswith("SNAPSHOT")
bundleOld = oldVersion if not oldIsSnapshot else oldVersion.replace("-SNAPSHOT","\.qualifier")
bundleNew = newVersion if not newIsSnapShot else newVersion.replace("-SNAPSHOT","\.qualifier")
runAndPrint("find -E ./ -regex \".*(MANIFEST\.MF|feature\.xml)\" | xargs -n 1 perl -pi -e \'s/" + bundleOld + "/" + bundleNew + "/g\'")
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)
print "done"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.ibm.wala_feature"
id="com.ibm.wala-feature"
label="%featureName"
version="1.5.1.qualifier"
version="1.3.8.qualifier"
provider-name="%providerName">
<plugin

View File

@ -5,8 +5,8 @@
<parent>
<artifactId>WALA</artifactId>
<groupId>com.ibm.wala</groupId>
<version>1.5.1-SNAPSHOT</version>
<version>1.3.8-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala_feature</artifactId>
<artifactId>com.ibm.wala-feature</artifactId>
<packaging>eclipse-feature</packaging>
</project>

View File

@ -1,9 +0,0 @@
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorList
USER_MANUAL_PREFERENCE=enabledManualValidatorList
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.700.v201610061600
eclipse.preferences.version=1
override=true
suspend=false
vals/org.eclipse.wst.html.core.HTMLValidator/groups=0107include06111contentType136org.eclipse.wst.html.core.htmlsourceT07fileext04htmlF07fileext05xhtmlF07fileext03htmF07fileext04htplF07fileext03wmlF0107exclude0104file139target/site/dependency-convergence.htmlT03
vf.version=3

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature id="com.ibm.wala_feature">
<feature id="com.ibm.wala-feature">
<category name="main"/>
</feature>
<feature id="com.ibm.wala_feature.source">
<feature id="com.ibm.wala-feature.source">
<category name="main"/>
</feature>
<feature id="com.ibm.wala.ide_feature">
<feature id="com.ibm.wala.ide-feature">
<category name="main"/>
</feature>
<feature id="com.ibm.wala.ide_feature.source">
<feature id="com.ibm.wala.ide-feature.source">
<category name="main"/>
</feature>
<category-def name="main" label="Wala"/>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.wala</groupId>
<artifactId>WALA</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.3.8-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala-repository</artifactId>
<packaging>eclipse-repository</packaging>

View File

@ -1,113 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
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
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=error
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.hiddenCatchBlock=error
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=error
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=error
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
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
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
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.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,32 +0,0 @@
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.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.src.includes=0
compilers.p.deprecated=0
compilers.p.discouraged-class=0
compilers.p.internal=0
compilers.p.missing-packages=0
compilers.p.missing-version-export-package=2
compilers.p.missing-version-import-package=0
compilers.p.missing-version-require-bundle=2
compilers.p.no-required-att=0
compilers.p.not-externalized-att=0
compilers.p.unknown-attribute=0
compilers.p.unknown-class=0
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.s.create-docs=false
compilers.s.doc-folder=doc
compilers.s.open-tags=0
eclipse.preferences.version=1

View File

@ -1,10 +0,0 @@
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorList
USER_MANUAL_PREFERENCE=enabledManualValidatorList
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.700.v201610061600
eclipse.preferences.version=1
override=true
suspend=false
vals/org.eclipse.wst.html.core.HTMLValidator/groups=0107include06111contentType136org.eclipse.wst.html.core.htmlsourceT07fileext04htmlF07fileext05xhtmlF07fileext03htmF07fileext04htplF07fileext03wmlF0107exclude0104file139target/site/dependency-convergence.htmlT03
vals/org.eclipse.wst.xml.core.xml/groups=0107include05111contentType128org.eclipse.core.runtime.xmlT111contentType134org.eclipse.wst.xml.core.xmlsourceT111contentType134org.eclipse.wst.xml.core.xslsourceT111contentType134org.eclipse.jst.jsp.core.tldsourceT07fileext03xmlF0107exclude07113projectNature134org.eclipse.jst.j2ee.ejb.EJBNature113projectNature130org.eclipse.jst.j2ee.EARNature04file08.projectT0104file110.classpathT0104file110.settings/T0204file122target/p2artifacts.xmlT0304file120target/p2content.xmlT03
vf.version=3

View File

@ -1,17 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.ecj
Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: com.ibm.wala.cast.java,
com.ibm.wala.core,
org.eclipse.core.runtime,
org.eclipse.jdt.core,
com.ibm.wala.cast,
com.ibm.wala.shrike
Export-Package: com.ibm.wala.cast.java.client,
com.ibm.wala.cast.java.ecj.util,
com.ibm.wala.cast.java.translator.jdt,
com.ibm.wala.cast.java.translator.jdt.ecj

View File

@ -1,3 +0,0 @@
#Properties file for com.ibm.wala.cast.java.ecj
Bundle-Name = WALA CAst Java ECJ frontend
Bundle-Vendor = IBM

View File

@ -1,15 +0,0 @@
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'),
)
}

View File

@ -1,6 +0,0 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/
javacProjectSettings = true

View File

@ -1,173 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast.java.ecj</artifactId>
<version>1.5.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>WALA CAst Java ECJ</name>
<description>WALA Common AST Java ECJ front-end</description>
<url>http://wala.sourceforge.net</url>
<licenses>
<license>
<name>Eclipse Public License, Version 1.0</name>
<url>https://www.eclipse.org/legal/epl-v10.html</url>
</license>
</licenses>
<developers>
<developer>
<name>Manu Sridharan</name>
<email>m.sridharan@samsung.com</email>
<organization>Samsung Research America</organization>
<organizationUrl>http://www.sisa.samsung.com/</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git@github.com:wala/WALA.git</connection>
<developerConnection>scm:git:git@github.com:example/example-application.git</developerConnection>
<url>git@github.com:example/example-application.git</url>
</scm>
<properties>
<src.dir>src</src.dir>
</properties>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.util</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast.java</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.core</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.shrike</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.runtime</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.10.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<profiles>
<profile>
<id>jdk18</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<javadoc.options>-Xdoclint:none</javadoc.options>
</properties>
</profile>
</profiles>
<build>
<sourceDirectory>${src.dir}</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>${javadoc.options}</additionalparam>
</configuration>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>WALA</artifactId>
<groupId>com.ibm.wala</groupId>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.java.ecj</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View File

@ -1,82 +0,0 @@
package com.ibm.wala.cast.java.ecj.util;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import java.util.jar.JarFile;
import com.ibm.wala.cast.ir.ssa.AstIRFactory;
import com.ibm.wala.cast.java.client.impl.ZeroOneContainerCFABuilderFactory;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.cast.java.translator.jdt.ecj.ECJClassLoaderFactory;
import com.ibm.wala.classLoader.SourceDirectoryTreeModule;
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.CallGraphBuilderCancelException;
import com.ibm.wala.ipa.callgraph.CallGraphStats;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.io.CommandLine;
import com.ibm.wala.util.warnings.Warnings;
/**
* Driver that constructs a call graph for an application specified as a directory of source code.
* Example of using the JDT front-end based on ECJ.
* Useful for getting some code to copy-paste.
*/
public class SourceDirCallGraph {
/**
* Usage: ScopeFileCallGraph -sourceDir file_path -mainClass class_name
*
* If given -mainClass, uses main() method of class_name as entrypoint. Class
* name should start with an 'L'.
*
* Example args: -sourceDir /tmp/srcTest -mainClass LFoo
*
*/
public static void main(String[] args) throws ClassHierarchyException, IllegalArgumentException, CallGraphBuilderCancelException, IOException {
long start = System.currentTimeMillis();
Properties p = CommandLine.parse(args);
String sourceDir = p.getProperty("sourceDir");
String mainClass = p.getProperty("mainClass");
AnalysisScope scope = new JavaSourceAnalysisScope();
// add standard libraries to scope
String[] stdlibs = WalaProperties.getJ2SEJarFiles();
for (String stdlib : stdlibs) {
scope.addToScope(ClassLoaderReference.Primordial, new JarFile(stdlib));
}
// add the source directory
scope.addToScope(JavaSourceAnalysisScope.SOURCE, new SourceDirectoryTreeModule(new File(sourceDir)));
// build the class hierarchy
IClassHierarchy cha = ClassHierarchyFactory.make(scope, new ECJClassLoaderFactory(scope.getExclusions()));
System.out.println(cha.getNumberOfClasses() + " classes");
System.out.println(Warnings.asString());
Warnings.clear();
AnalysisOptions options = new AnalysisOptions();
Iterable<Entrypoint> entrypoints = Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE, cha, new String[] { mainClass } );
options.setEntrypoints(entrypoints);
// you can dial down reflection handling if you like
// options.setReflectionOptions(ReflectionOptions.NONE);
IAnalysisCacheView cache = new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory());
//CallGraphBuilder builder = new ZeroCFABuilderFactory().make(options, cache, cha, scope, false);
CallGraphBuilder<?> builder = new ZeroOneContainerCFABuilderFactory().make(options, cache, cha, scope);
System.out.println("building call graph...");
CallGraph cg = builder.makeCallGraph(options, null);
long end = System.currentTimeMillis();
System.out.println("done");
System.out.println("took " + (end-start) + "ms");
System.out.println(CallGraphStats.getStats(cg));
}
}

View File

@ -1,39 +0,0 @@
package com.ibm.wala.cast.java.translator.jdt.ecj;
import java.io.IOException;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
import com.ibm.wala.classLoader.ClassLoaderImpl;
import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class ECJClassLoaderFactory extends ClassLoaderFactoryImpl {
public ECJClassLoaderFactory(SetOfClasses exclusions) {
super(exclusions);
}
// TODO remove code duplication with JDTClassLoaderFactory
@Override
protected IClassLoader makeNewClassLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent,
AnalysisScope scope) throws IOException {
if (classLoaderReference.equals(JavaSourceAnalysisScope.SOURCE)) {
ClassLoaderImpl cl = makeSourceLoader(classLoaderReference, cha, parent);
cl.init(scope.getModules(classLoaderReference));
return cl;
} else {
return super.makeNewClassLoader(classLoaderReference, cha, parent, scope);
}
}
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent) {
return new ECJSourceLoaderImpl(classLoaderReference, parent, cha, false);
}
}

View File

@ -1,62 +0,0 @@
/*
* 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.
*
* This file is a derivative of code released by the University of
* California under the terms listed below.
*
* WALA JDT Frontend is Copyright (c) 2008 The Regents of the
* University of California (Regents). Provided that this notice and
* the following two paragraphs are included in any distribution of
* Refinement Analysis Tools or its derivative work, Regents agrees
* not to assert any of Regents' copyright rights in Refinement
* Analysis Tools against recipient for recipient's reproduction,
* preparation of derivative works, public display, public
* performance, distribution or sublicensing of Refinement Analysis
* Tools and derivative works, in source code and object code form.
* This agreement not to assert does not confer, by implication,
* estoppel, or otherwise any license or rights in any intellectual
* property of Regents, including, but not limited to, any patents
* of Regents or Regents' employees.
*
* IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
* INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE
* AND ITS DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE AND FURTHER DISCLAIMS ANY STATUTORY
* WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE AND ACCOMPANYING
* DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
* IS". REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
* UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
package com.ibm.wala.cast.java.translator.jdt.ecj;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
public class ECJSourceLoaderImpl extends JavaSourceLoaderImpl {
private final boolean dump;
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha) {
this(loaderRef, parent, cha, false);
}
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, cha);
this.dump = dump;
}
@Override
protected SourceModuleTranslator getTranslator() {
return new ECJSourceModuleTranslator(cha.getScope(), this, dump);
}
}

View File

@ -1,210 +0,0 @@
/*
* 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.
*
* This file is a derivative of code released by the University of
* California under the terms listed below.
*
* WALA JDT Frontend is Copyright (c) 2008 The Regents of the
* University of California (Regents). Provided that this notice and
* the following two paragraphs are included in any distribution of
* Refinement Analysis Tools or its derivative work, Regents agrees
* not to assert any of Regents' copyright rights in Refinement
* Analysis Tools against recipient for recipient's reproduction,
* preparation of derivative works, public display, public
* performance, distribution or sublicensing of Refinement Analysis
* Tools and derivative works, in source code and object code form.
* This agreement not to assert does not confer, by implication,
* estoppel, or otherwise any license or rights in any intellectual
* property of Regents, including, but not limited to, any patents
* of Regents or Regents' employees.
*
* IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
* INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE
* AND ITS DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE AND FURTHER DISCLAIMS ANY STATUTORY
* WARRANTY OF NON-INFRINGEMENT. THE SOFTWARE AND ACCOMPANYING
* DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
* IS". REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
* UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
package com.ibm.wala.cast.java.translator.jdt.ecj;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.FileASTRequestor;
import com.ibm.wala.cast.java.translator.Java2IRTranslator;
import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator;
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
import com.ibm.wala.cast.tree.impl.RangePosition;
import com.ibm.wala.classLoader.DirectoryTreeModule;
import com.ibm.wala.classLoader.JarFileModule;
import com.ibm.wala.classLoader.JarStreamModule;
import com.ibm.wala.classLoader.Module;
import com.ibm.wala.classLoader.ModuleEntry;
import com.ibm.wala.classLoader.SourceFileModule;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.collections.Pair;
import com.ibm.wala.util.io.TemporaryFile;
/**
* A SourceModuleTranslator whose implementation of loadAllSources() uses the PolyglotFrontEnd pseudo-compiler to generate DOMO IR
* for the sources in the compile-time classpath.
*
* @author rfuhrer
*/
// remove me comment: Jdt little-case = not OK, upper case = OK
public class ECJSourceModuleTranslator implements SourceModuleTranslator {
private final class ECJAstToIR extends FileASTRequestor {
private final Map<String, ModuleEntry> sourceMap;
public ECJAstToIR(Map<String, ModuleEntry> sourceMap) {
this.sourceMap = sourceMap;
}
@Override
public void acceptAST(String source, CompilationUnit ast) {
JDTJava2CAstTranslator<Position> jdt2cast = makeCAstTranslator(ast, source);
final Java2IRTranslator java2ir = makeIRTranslator();
java2ir.translate(sourceMap.get(source), jdt2cast.translateToCAst());
if (! "true".equals(System.getProperty("wala.jdt.quiet"))) {
IProblem[] problems = ast.getProblems();
int length = problems.length;
if (length > 0) {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < length; i++) {
buffer.append(problems[i].getMessage());
buffer.append('\n');
}
if (length != 0)
System.err.println("Unexpected problems in " + source + "\n " + buffer.toString());
}
}
}
}
protected boolean dump;
protected ECJSourceLoaderImpl sourceLoader;
private final String[] sources;
private final String[] libs;
public ECJSourceModuleTranslator(AnalysisScope scope, ECJSourceLoaderImpl sourceLoader) {
this(scope, sourceLoader, false);
}
public ECJSourceModuleTranslator(AnalysisScope scope, ECJSourceLoaderImpl sourceLoader, boolean dump) {
this.sourceLoader = sourceLoader;
this.dump = dump;
Pair<String[], String[]> paths = computeClassPath(scope);
sources = paths.fst;
libs = paths.snd;
}
private static Pair<String[],String[]> computeClassPath(AnalysisScope scope) {
List<String> sources = new LinkedList<>();
List<String> libs = new LinkedList<>();
for (ClassLoaderReference cl : scope.getLoaders()) {
while (cl != null) {
List<Module> modules = scope.getModules(cl);
for (Module m : modules) {
if (m instanceof JarFileModule) {
JarFileModule jarFileModule = (JarFileModule) m;
libs.add(jarFileModule.getAbsolutePath());
} else if (m instanceof JarStreamModule) {
try {
File F = File.createTempFile("tmp", "jar");
F.deleteOnExit();
TemporaryFile.streamToFile(F, ((JarStreamModule)m));
libs.add(F.getAbsolutePath());
} catch (IOException e) {
assert false : e;
}
} else if (m instanceof DirectoryTreeModule) {
DirectoryTreeModule directoryTreeModule = (DirectoryTreeModule) m;
sources.add(directoryTreeModule.getPath());
} else {
//Assertions.UNREACHABLE("Module entry is neither jar file nor directory");
}
}
cl = cl.getParent();
}
}
return Pair.make(sources.toArray(new String[ sources.size() ]), libs.toArray(new String[ libs.size() ]));
}
/*
* Project -> AST code from org.eclipse.jdt.core.tests.performance
*/
@Override
public void loadAllSources(Set<ModuleEntry> modules) {
List<String> sources = new LinkedList<>();
Map<String, ModuleEntry> sourceMap = HashMapFactory.make();
for(ModuleEntry m : modules) {
if (m.isSourceFile()) {
SourceFileModule s = (SourceFileModule)m;
sourceMap.put(s.getAbsolutePath(), s);
sources.add(s.getAbsolutePath());
}
}
String[] sourceFiles = sources.toArray(new String[ sources.size() ]);
final ASTParser parser = ASTParser.newParser(AST.JLS8);
parser.setResolveBindings(true);
parser.setEnvironment(libs, this.sources, null, false);
Hashtable<String, String> options = JavaCore.getOptions();
options.put(JavaCore.COMPILER_SOURCE, "1.8");
parser.setCompilerOptions(options);
parser.createASTs(sourceFiles, null, new String[0], new ECJAstToIR(sourceMap), new NullProgressMonitor());
}
protected Java2IRTranslator makeIRTranslator() {
return new Java2IRTranslator(sourceLoader);
}
protected JDTJava2CAstTranslator<Position> makeCAstTranslator(CompilationUnit cu, String fullPath) {
return new JDTJava2CAstTranslator<Position>(sourceLoader, cu, fullPath, false, dump) {
@Override
public Position makePosition(int start, int end) {
try {
return new RangePosition(new URL("file://" + fullPath), this.cu.getLineNumber(start), start, end);
} catch (MalformedURLException e) {
throw new RuntimeException("bad file: " + fullPath, e);
}
}
};
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.ide.jdt.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="source"/>
<classpathentry kind="lib" path="/com.ibm.wala.cast.java.polyglot/lib/polyglot.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.java.polyglot.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,125 +1,78 @@
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
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.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=1.6
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.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error
org.eclipse.jdt.core.compiler.problem.deprecation=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=error
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=error
org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=error
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=error
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
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
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
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.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0

View File

@ -0,0 +1,4 @@
#Mon Apr 13 15:21:17 EDT 2009
eclipse.preferences.version=1
formatter_profile=_WALA
formatter_settings_version=11

View File

@ -0,0 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA Cast Java Polyglot Test Plug-in
Bundle-SymbolicName: com.ibm.wala.cast.java.polyglot.test
Bundle-Version: 1.3.8.qualifier
Bundle-Activator: com.ibm.wala.cast.java.polyglot.test.Activator
Bundle-Vendor: IBM
Require-Bundle: com.ibm.wala.cast;bundle-version="1.0.0",
com.ibm.wala.cast.java;bundle-version="1.0.0",
com.ibm.wala.cast.java.test;bundle-version="1.0.0",
com.ibm.wala.core;bundle-version="1.1.3",
com.ibm.wala.core.tests;bundle-version="1.1.3",
org.eclipse.core.runtime,
com.ibm.wala.cast.test;bundle-version="1.0.0",
com.ibm.wala.cast.java.polyglot;bundle-version="1.0.0",
org.junit;bundle-version="4.0.0",
com.ibm.wala.cast.java.test.data;bundle-version="1.3.4"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy

View File

@ -0,0 +1,4 @@
source.. = source/
output.. = bin/
bin.includes = META-INF/,\
.

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<stringAttribute key="bad_container_name" value="/com.ibm.wala.cast.java.polyglottest/launchers"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.cast.java.polyglot.test/source/com/ibm/wala/cast/java/test/PolyglotJLexTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="/tmp/jlexpolytest.out"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.PolyglotJLexTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.java.polyglot.test"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dcom.ibm.wala.tracefile=/tmp/jlexpolytrace.txt"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:com.ibm.wala.cast.java.test.data}"/>
</launchConfiguration>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<stringAttribute key="bad_container_name" value="/com.ibm.wala.cast.java.polyglottest/launchers"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.cast.java.polyglot.test/source/com/ibm/wala/cast/java/test/PolyglotJavaIRTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
<mapEntry key="[run]" value="org.eclipse.jdt.junit.launchconfig"/>
</mapAttribute>
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="/tmp/console.txt"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.PolyglotJavaIRTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.java.polyglot.test"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx512M"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:com.ibm.wala.cast.java.test.data}"/>
</launchConfiguration>

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<stringAttribute key="bad_container_name" value="/com.ibm.wala.cast.java.polyglottest/launchers"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.ide.jdt.test/source/com/ibm/wala/cast/java/test/ECJJavaIRTest.java"/>
<listEntry value="/com.ibm.wala.cast.java.polyglot.test/source/com/ibm/wala/cast/java/test/PolyglotSyncDuplicatorTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -10,9 +11,7 @@
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.buildship.core.classpathprovider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.ECJJavaIRTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.ide.jdt.test"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.PolyglotSyncDuplicatorTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.java.polyglot.test"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:com.ibm.wala.cast.java.test.data}"/>
</launchConfiguration>

View File

@ -2,12 +2,12 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.wala</groupId>
<artifactId>WALA</artifactId>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.js.nodejs.test</artifactId>
<parent>
<groupId>com.ibm.wala</groupId>
<artifactId>WALA</artifactId>
<version>1.3.8-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.java.polyglot.test</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
@ -20,8 +20,9 @@
<phase>test</phase>
<configuration>
<testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
<argLine>-Xmx800M -ea</argLine>
<argLine>-Xmx1200M -ea</argLine>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<workingDirectory>${basedir}/../com.ibm.wala.cast.java.test.data</workingDirectory>
</configuration>
<goals>
<goal>test</goal>
@ -35,7 +36,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -0,0 +1,60 @@
/*******************************************************************************
* 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
*******************************************************************************/
package com.ibm.wala.cast.java.polyglot.test;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.ibm.wala.cast.java.polyglot.test";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}

View File

@ -0,0 +1,36 @@
/*******************************************************************************
* 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
*******************************************************************************/
package com.ibm.wala.cast.java.test;
import java.util.Collection;
import java.util.List;
import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.cast.java.translator.polyglot.PolyglotJavaSourceAnalysisEngine;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.IClassHierarchy;
public class PolyglotJLexTest extends JLexTest {
@Override
protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) {
JavaSourceAnalysisEngine engine = new PolyglotJavaSourceAnalysisEngine() {
@Override
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha) {
return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE, cha, new String[] { "LJLex/Main" });
}
};
engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
populateScope(engine, sources, libs);
return engine;
}
}

View File

@ -9,27 +9,25 @@ package com.ibm.wala.cast.java.test;
import java.util.Collection;
import java.util.List;
import com.ibm.wala.cast.java.client.ECJJavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.cast.java.translator.polyglot.PolyglotJavaSourceAnalysisEngine;
import com.ibm.wala.client.AbstractAnalysisEngine;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.cha.IClassHierarchy;
public class ECJJavaIRTest extends JavaIRTests {
public class PolyglotJavaIRTest extends JavaIRTests {
public ECJJavaIRTest() {
public PolyglotJavaIRTest() {
super(null);
}
@Override
protected <I extends InstanceKey> AbstractAnalysisEngine<I, CallGraphBuilder<I>, ?> getAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) {
JavaSourceAnalysisEngine<I> engine = new ECJJavaSourceAnalysisEngine<I>() {
protected AbstractAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) {
JavaSourceAnalysisEngine engine = new PolyglotJavaSourceAnalysisEngine() {
@Override
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha) {
return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE, cha, mainClassDescriptors);

View File

@ -0,0 +1,55 @@
/*******************************************************************************
* 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
*******************************************************************************/
package com.ibm.wala.cast.java.test;
import java.util.Collection;
import java.util.List;
import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
import com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.cast.java.translator.polyglot.IRTranslatorExtension;
import com.ibm.wala.cast.java.translator.polyglot.JavaIRTranslatorExtension;
import com.ibm.wala.cast.java.translator.polyglot.PolyglotJavaSourceAnalysisEngine;
import com.ibm.wala.cast.tree.CAst;
import com.ibm.wala.cast.tree.rewrite.CAstRewriter;
import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.IClassHierarchy;
public class PolyglotSyncDuplicatorTest extends SyncDuplicatorTest {
@Override
protected JavaSourceAnalysisEngine getAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs) {
JavaSourceAnalysisEngine engine = new PolyglotJavaSourceAnalysisEngine() {
@Override
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha) {
return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE, cha, mainClassDescriptors);
}
@Override
public IRTranslatorExtension getTranslatorExtension() {
JavaIRTranslatorExtension ext = new JavaIRTranslatorExtension();
ext.setCAstRewriterFactory(new CAstRewriterFactory() {
@Override
public CAstRewriter createCAstRewriter(CAst ast) {
return new SynchronizedBlockDuplicator(ast, true, testMethod);
}
});
return ext;
}
};
engine.setExclusionsFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
populateScope(engine, sources, libs);
return engine;
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="source"/>
<classpathentry exported="true" kind="lib" path="lib/java_cup.jar"/>
<classpathentry exported="true" kind="lib" path="lib/polyglot.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.java.polyglot</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,126 +1,78 @@
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
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.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=1.6
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.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error
org.eclipse.jdt.core.compiler.problem.deprecation=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=error
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=error
org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
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=error
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0

View File

@ -0,0 +1,4 @@
#Mon Apr 13 15:38:50 EDT 2009
eclipse.preferences.version=1
formatter_profile=_WALA
formatter_settings_version=11

View File

@ -0,0 +1,48 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA CAst Java Polyglot Plug-in
Bundle-SymbolicName: com.ibm.wala.cast.java.polyglot
Bundle-Version: 1.3.8.qualifier
Bundle-Vendor: IBM
Require-Bundle: com.ibm.wala.cast.java,
com.ibm.wala.cast,
com.ibm.wala.core,
org.eclipse.core.runtime,
com.ibm.wala.shrike,
org.eclipse.jdt.core,
org.eclipse.core.resources
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.ibm.wala.cast.java.translator.polyglot;
uses:="com.ibm.wala.types,
polyglot.types,
polyglot.util,
polyglot.ast,
com.ibm.wala.ipa.cha,
com.ibm.wala.cast.java.client,
com.ibm.wala.classLoader,
com.ibm.wala.cast.tree,
com.ibm.wala.cast.java.loader,
com.ibm.wala.ipa.callgraph.impl,
com.ibm.wala.ipa.callgraph,
polyglot.frontend.goals,
com.ibm.wala.cast.tree.impl,
com.ibm.wala.cast.java.translator,
com.ibm.wala.cast.java.types",
java_cup,
java_cup.runtime,
polyglot.ast,
polyglot.dispatch,
polyglot.frontend,
polyglot.lex,
polyglot.main,
polyglot.parse,
polyglot.qq,
polyglot.types,
polyglot.types.reflect,
polyglot.util,
polyglot.util.typedump,
polyglot.visit
Bundle-ClassPath: lib/java_cup.jar,
lib/polyglot.jar,
.

View File

@ -0,0 +1,6 @@
source.. = source/
output.. = bin/
bin.includes = META-INF/,\
.,\
lib/java_cup.jar,\
lib/polyglot.jar

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="com.ibm.wala.cast.java.polyglot" default="getJars" basedir=".">
<property name="basews" value="${ws}"/>
<property name="baseos" value="${os}"/>
<property name="basearch" value="${arch}"/>
<property name="basenl" value="${nl}"/>
<!-- Compiler settings. -->
<property name="javacFailOnError" value="true"/>
<property name="javacDebugInfo" value="on"/>
<property name="javacVerbose" value="false"/>
<property name="logExtension" value=".log"/>
<property name="compilerArg" value=""/>
<property name="javacSource" value="1.5"/>
<property name="javacTarget" value="1.5"/>
<!-- This property has been updated to correspond to the paths used by the latest Java update
on Mac OS X 10.6 (Java version 1.6.0_22). If you are not using this version of Mac OS X or Java,
try changing the value of the property to "${java.home}/../../../Classes" -->
<!-- <condition property="dir_bootclasspath" value="${java.home}/../Classes">
<os family="mac"/>
</condition>
<property name="dir_bootclasspath" value="${java.home}/lib"/>
<path id="path_bootclasspath">
<fileset dir="${dir_bootclasspath}">
<include name="*.jar"/>
</fileset>
</path>
<property name="bootclasspath" refid="path_bootclasspath"/>
<property name="bundleJavacSource" value="${javacSource}"/>
<property name="bundleJavacTarget" value="${javacTarget}"/>
<property name="bundleBootClasspath" value="${bootclasspath}"/> -->
<target name="PolyglotPresent" depends="init">
<available file="${plugin.destination}/lib/polyglot.jar" property="polyglot.present"/>
</target>
<target name="fetchPolyglot" depends="PolyglotPresent" unless="polyglot.present">
<delete dir="${temp.folder}"/>
<mkdir dir="${temp.folder}"/>
<echo message="Getting polyglot from svn; may take a few minutes"/>
<exec executable="svn"
dir="${temp.folder}">
<arg value="--quiet"/>
<arg value="checkout"/>
<arg value="http://polyglot-compiler.googlecode.com/svn/trunk/"/>
<arg value="polyglot-compiler-read-only"/>
</exec>
<ant target="jar" inheritAll="false" dir="${temp.folder}/polyglot-compiler-read-only/polyglot/" />
<copy file="${temp.folder}/polyglot-compiler-read-only/polyglot/lib/polyglot.jar" tofile="${plugin.destination}/lib/polyglot.jar" />
<copy file="${temp.folder}/polyglot-compiler-read-only/polyglot/lib/java_cup.jar" tofile="${plugin.destination}/lib/java_cup.jar" />
<delete dir="${temp.folder}"/>
</target>
<target name="getJars" depends="fetchPolyglot" />
<target name="init" depends="properties">
<condition property="pluginTemp" value="${buildTempFolder}/plugins">
<isset property="buildTempFolder"/>
</condition>
<property name="pluginTemp" value="${basedir}"/>
<condition property="build.result.folder" value="${pluginTemp}/com.ibm.wala.core.testdata">
<isset property="buildTempFolder"/>
</condition>
<property name="build.result.folder" value="${basedir}"/>
<property name="temp.folder" value="${basedir}/temp.folder"/>
<property name="plugin.destination" value="${basedir}"/>
</target>
<target name="properties" if="eclipse.running">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</target>
</project>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>WALA</artifactId>
<groupId>com.ibm.wala</groupId>
<version>1.3.8-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.java.polyglot</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<property name="compile_classpath" refid="maven.compile.classpath" />
<ant antfile="${basedir}/build.xml" target="getJars" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,204 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
/*
* Created on Sep 1, 2005
*/
package com.ibm.wala.cast.java.translator.polyglot;
import polyglot.ast.ArrayAccess;
import polyglot.ast.ArrayAccessAssign;
import polyglot.ast.ArrayInit;
import polyglot.ast.ArrayTypeNode;
import polyglot.ast.Assert;
import polyglot.ast.Binary;
import polyglot.ast.Block;
import polyglot.ast.BooleanLit;
import polyglot.ast.Branch;
import polyglot.ast.Call;
import polyglot.ast.CanonicalTypeNode;
import polyglot.ast.Case;
import polyglot.ast.Cast;
import polyglot.ast.Catch;
import polyglot.ast.CharLit;
import polyglot.ast.ClassBody;
import polyglot.ast.ClassDecl;
import polyglot.ast.ClassLit;
import polyglot.ast.Conditional;
import polyglot.ast.ConstructorCall;
import polyglot.ast.ConstructorDecl;
import polyglot.ast.Do;
import polyglot.ast.Empty;
import polyglot.ast.Eval;
import polyglot.ast.Field;
import polyglot.ast.FieldAssign;
import polyglot.ast.FieldDecl;
import polyglot.ast.FloatLit;
import polyglot.ast.For;
import polyglot.ast.Formal;
import polyglot.ast.If;
import polyglot.ast.Import;
import polyglot.ast.Initializer;
import polyglot.ast.Instanceof;
import polyglot.ast.IntLit;
import polyglot.ast.Labeled;
import polyglot.ast.Local;
import polyglot.ast.LocalAssign;
import polyglot.ast.LocalClassDecl;
import polyglot.ast.LocalDecl;
import polyglot.ast.MethodDecl;
import polyglot.ast.New;
import polyglot.ast.NewArray;
import polyglot.ast.Node;
import polyglot.ast.NullLit;
import polyglot.ast.PackageNode;
import polyglot.ast.Return;
import polyglot.ast.Special;
import polyglot.ast.StringLit;
import polyglot.ast.Switch;
import polyglot.ast.SwitchBlock;
import polyglot.ast.Synchronized;
import polyglot.ast.Throw;
import polyglot.ast.Try;
import polyglot.ast.Unary;
import polyglot.ast.While;
import com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.MethodContext;
import com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.WalkContext;
import com.ibm.wala.cast.tree.CAstNode;
import com.ibm.wala.util.debug.Assertions;
/**
* Wrapper for the logic (nasty cascaded instanceof tests) necessary to visit a Polyglot AST and dispatch to the appropriate
* TranslatingVisitor methods for each AST node type.
*
* @author rfuhrer
*/
public class ASTTraverser {
protected ASTTraverser() {
}
public static CAstNode visit(Node n, TranslatingVisitor tv, WalkContext wc) {
if (n instanceof MethodDecl) {
return tv.visit((MethodDecl) n, (MethodContext) wc);
} else if (n instanceof ConstructorDecl) {
return tv.visit((ConstructorDecl) n, (MethodContext) wc);
} else if (n instanceof FieldDecl) {
return tv.visit((FieldDecl) n, (MethodContext) wc);
} else if (n instanceof Import) {
return tv.visit((Import) n, wc);
} else if (n instanceof PackageNode) {
return tv.visit((PackageNode) n, wc);
} else if (n instanceof CanonicalTypeNode) {
return tv.visit((CanonicalTypeNode) n, wc);
} else if (n instanceof ArrayTypeNode) {
return tv.visit((ArrayTypeNode) n, wc);
} else if (n instanceof ArrayInit) {
return tv.visit((ArrayInit) n, wc);
} else if (n instanceof ArrayAccessAssign) {
return tv.visit((ArrayAccessAssign) n, wc);
} else if (n instanceof FieldAssign) {
return tv.visit((FieldAssign) n, wc);
} else if (n instanceof LocalAssign) {
return tv.visit((LocalAssign) n, wc);
} else if (n instanceof Binary) {
return tv.visit((Binary) n, wc);
} else if (n instanceof Call) {
return tv.visit((Call) n, wc);
} else if (n instanceof ConstructorCall) {
return tv.visit((ConstructorCall) n, wc);
} else if (n instanceof Cast) {
return tv.visit((Cast) n, wc);
} else if (n instanceof Conditional) {
return tv.visit((Conditional) n, wc);
} else if (n instanceof Instanceof) {
return tv.visit((Instanceof) n, wc);
} else if (n instanceof BooleanLit) {
return tv.visit((BooleanLit) n, wc);
} else if (n instanceof ClassLit) {
return tv.visit((ClassLit) n, wc);
} else if (n instanceof FloatLit) {
return tv.visit((FloatLit) n, wc);
} else if (n instanceof NullLit) {
return tv.visit((NullLit) n, wc);
} else if (n instanceof CharLit) {
return tv.visit((CharLit) n, wc);
} else if (n instanceof IntLit) {
return tv.visit((IntLit) n, wc);
} else if (n instanceof StringLit) {
return tv.visit((StringLit) n, wc);
} else if (n instanceof New) {
return tv.visit((New) n, wc);
} else if (n instanceof NewArray) {
return tv.visit((NewArray) n, wc);
} else if (n instanceof Special) {
return tv.visit((Special) n, wc);
} else if (n instanceof Unary) {
return tv.visit((Unary) n, wc);
} else if (n instanceof ArrayAccess) {
return tv.visit((ArrayAccess) n, wc);
} else if (n instanceof Field) {
return tv.visit((Field) n, wc);
} else if (n instanceof Local) {
return tv.visit((Local) n, wc);
} else if (n instanceof ClassBody) {
return tv.visit((ClassBody) n, wc);
} else if (n instanceof ClassDecl) {
return tv.visit((ClassDecl) n, wc);
} else if (n instanceof Initializer) {
return tv.visit((Initializer) n, wc);
} else if (n instanceof Assert) {
return tv.visit((Assert) n, wc);
} else if (n instanceof Branch) {
return tv.visit((Branch) n, wc);
} else if (n instanceof SwitchBlock) { // must test for this one before Block
return tv.visit((SwitchBlock) n, wc);
} else if (n instanceof Block) { // must test for this one before Block
return tv.visit((Block) n, wc);
} else if (n instanceof Catch) {
return tv.visit((Catch) n, wc);
} else if (n instanceof If) {
return tv.visit((If) n, wc);
} else if (n instanceof Labeled) {
return tv.visit((Labeled) n, wc);
} else if (n instanceof LocalClassDecl) {
return tv.visit((LocalClassDecl) n, wc);
} else if (n instanceof Do) {
return tv.visit((Do) n, wc);
} else if (n instanceof For) {
return tv.visit((For) n, wc);
} else if (n instanceof While) {
return tv.visit((While) n, wc);
} else if (n instanceof Switch) {
return tv.visit((Switch) n, wc);
} else if (n instanceof Synchronized) {
return tv.visit((Synchronized) n, wc);
} else if (n instanceof Try) {
return tv.visit((Try) n, wc);
} else if (n instanceof Empty) {
return tv.visit((Empty) n, wc);
} else if (n instanceof Eval) {
return tv.visit((Eval) n, wc);
} else if (n instanceof LocalDecl) {
return tv.visit((LocalDecl) n, wc);
} else if (n instanceof Return) {
return tv.visit((Return) n, wc);
} else if (n instanceof Case) {
return tv.visit((Case) n, wc);
} else if (n instanceof Throw) {
return tv.visit((Throw) n, wc);
} else if (n instanceof Formal) {
return tv.visit((Formal) n, wc);
} else {
Assertions.UNREACHABLE("Unhandled node " + n + " of type " + n.getClass().getName() + " in ASTTraverser.visit().");
return null;
}
}
}

View File

@ -0,0 +1,48 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
package com.ibm.wala.cast.java.translator.polyglot;
import polyglot.ast.ArrayInit;
import polyglot.ast.Expr;
import polyglot.frontend.Job;
import polyglot.frontend.Scheduler;
import polyglot.frontend.VisitorGoal;
import polyglot.types.SemanticException;
import polyglot.types.Type;
import polyglot.visit.AscriptionVisitor;
/**
* Runs an AscriptionVisitor to make sure that empty array literals actually get a type.
* @author rfuhrer
*/
public class AscriptionGoal extends VisitorGoal {
/**
*
*/
private static final long serialVersionUID = 7416951196743862079L;
public AscriptionGoal(Job job) {
super(job,
new AscriptionVisitor(job, job.extensionInfo().typeSystem(), job.extensionInfo().nodeFactory()) {
@Override
public Expr ascribe(Expr e, Type toType) throws SemanticException {
if (e instanceof ArrayInit && e.type().isNull()) {
return e.type(toType);
}
return super.ascribe(e, toType);
}
}
);
Scheduler scheduler= job.extensionInfo().scheduler();
addPrereq(scheduler.TypeChecked(job));
}
}

View File

@ -0,0 +1,73 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
package com.ibm.wala.cast.java.translator.polyglot;
import polyglot.frontend.ExtensionInfo;
import polyglot.frontend.Job;
import polyglot.frontend.Scheduler;
import polyglot.frontend.SourceGoal_c;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
import com.ibm.wala.cast.java.translator.Java2IRTranslator;
/**
* A kind of EndGoal that indicates that WALA IR has been generated for the given compilation unit.
* @author rfuhrer
*/
public class IRGoal extends SourceGoal_c /* PORT1.7 removed 'implements EndGoal' */ {
/**
*
*/
private static final long serialVersionUID = -8023929848709826817L;
private JavaSourceLoaderImpl fSourceLoader;
protected Java2IRTranslator fTranslator;
public IRGoal(Job job, JavaSourceLoaderImpl sourceLoader) {
super(job);
fSourceLoader = sourceLoader;
Scheduler scheduler= job.extensionInfo().scheduler();
addPrereq(scheduler.TypeChecked(job));
// PORT1.7 - TypeChecked will suffice for what used to require ConstantsChecked.
// Need ConstantsChecked in order to make sure that case statements have non-zero labels.
// addPrereq(scheduler.ConstantsChecked(job));
// Need to add an AscriptionGoal as a prereq to make sure that empty array initializers get a type ascribed.
addPrereq(new AscriptionGoal(job));
}
@Override
public boolean runTask() {
ExtensionInfo extInfo= job.extensionInfo();
fTranslator= new Java2IRTranslator(
fSourceLoader,
((IRTranslatorExtension)extInfo).getCAstRewriterFactory());
ModuleSource src = (ModuleSource) job.source();
fTranslator.translate(
src.getModule(),
new PolyglotJava2CAstTranslator(
job.ast(),
fSourceLoader.getReference(),
extInfo.nodeFactory(),
extInfo.typeSystem(),
new PolyglotIdentityMapper(fSourceLoader.getReference()),
((IRTranslatorExtension)extInfo).getReplicateForDoLoops()).translateToCAst());
return true;
}
@Override
public String name() {
return "<WALA IR goal for " + job.source().path() + ">";
}
}

View File

@ -0,0 +1,32 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
/*
* Created on Oct 21, 2005
*/
package com.ibm.wala.cast.java.translator.polyglot;
import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
public interface IRTranslatorExtension {
void setSourceLoader(PolyglotSourceLoaderImpl jsli);
/**
* @return the identity mapper, for mapping AST nodes to WALA TypeReferences, MethodReferences and FieldReferences. Helps clients
* to correlate analysis results to AST nodes.
*/
PolyglotIdentityMapper getIdentityMapper();
/**
*/
CAstRewriterFactory<?,?> getCAstRewriterFactory();
boolean getReplicateForDoLoops();
}

View File

@ -0,0 +1,79 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
/*
* Created on Oct 6, 2005
*/
package com.ibm.wala.cast.java.translator.polyglot;
import java.util.List;
import polyglot.frontend.Goal;
import polyglot.frontend.JLExtensionInfo;
import polyglot.frontend.JLScheduler;
import polyglot.frontend.Job;
import polyglot.frontend.Scheduler;
import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
/**
* A Polyglot extension descriptor for a test harness extension that generates WALA IR for
* the sources and class files in the classpath.
* @author rfuhrer
*/
public class JavaIRTranslatorExtension extends JLExtensionInfo implements IRTranslatorExtension {
protected PolyglotSourceLoaderImpl fSourceLoader;
protected PolyglotIdentityMapper fMapper;
protected CAstRewriterFactory<?,?> rewriterFactory;
//PORT1.7 getCompileGoal() no longer exists; set the compile goal by manipulating the End goal for the job
@Override
protected Scheduler createScheduler() {
return new JLScheduler(this) {
@Override
public List<Goal> goals(Job job) {
List<Goal> goals= super.goals(job);
Goal endGoal = goals.get(goals.size()-1);
if (!(endGoal.name().equals("End"))) {
throw new IllegalStateException("Last goal is not an End goal?");
}
endGoal.addPrereq(new IRGoal(job, fSourceLoader));
return goals;
}
};
}
@Override
public void setSourceLoader(PolyglotSourceLoaderImpl sourceLoader) {
fSourceLoader= sourceLoader;
fMapper= new PolyglotIdentityMapper(sourceLoader.getReference());
}
@Override
public PolyglotIdentityMapper getIdentityMapper() {
return fMapper;
}
public void setCAstRewriterFactory(CAstRewriterFactory<?,?> factory) {
rewriterFactory = factory;
}
@Override
public CAstRewriterFactory<?,?> getCAstRewriterFactory() {
return rewriterFactory;
}
@Override
public boolean getReplicateForDoLoops() {
return false;
}
}

View File

@ -0,0 +1,63 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
/*
* Created on Oct 6, 2005
*/
package com.ibm.wala.cast.java.translator.polyglot;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import polyglot.frontend.FileSource;
import polyglot.frontend.Resource;
import com.ibm.wala.classLoader.SourceModule;
/**
* A Polyglot Source whose input comes from an InputStream.<br>
* Currently extends FileSource since that's all that the Polyglot Compiler class
* will accept.
* @author rfuhrer
*/
public class ModuleSource extends FileSource {
private final SourceModule module;
SourceModule getModule() {
return module;
}
public ModuleSource(final SourceModule module) throws IOException {
super(new Resource() {
@Override
public File file() {
return new File(module.getURL().getFile());
}
@Override
public InputStream getInputStream() throws IOException {
return module.getInputStream();
}
@Override
public String name() {
String fullPath = module.getURL().getFile();
int idx= fullPath.lastIndexOf(File.separatorChar);
return (idx > 0) ? fullPath.substring(idx+1) : fullPath;
}
@Override
public String toString() {
return module.getName();
}
}, true);
this.module = module;
}
}

View File

@ -0,0 +1,58 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
/*
* Created on Oct 7, 2005
*/
package com.ibm.wala.cast.java.translator.polyglot;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
import com.ibm.wala.classLoader.ClassLoaderImpl;
import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class PolyglotClassLoaderFactory extends ClassLoaderFactoryImpl {
/**
* A map from ClassLoaderReference to IRTranslatorExtension, so that source files in different languages are processed by the
* right kind of IRTranslatorExtension.
*/
final protected Map<ClassLoaderReference, IRTranslatorExtension> fExtensionMap = new HashMap<ClassLoaderReference, IRTranslatorExtension>();
public PolyglotClassLoaderFactory(SetOfClasses exclusions, IRTranslatorExtension javaExtInfo) {
super(exclusions);
fExtensionMap.put(JavaSourceAnalysisScope.SOURCE, javaExtInfo);
}
protected IRTranslatorExtension getExtensionFor(ClassLoaderReference clr) {
return fExtensionMap.get(clr);
}
@Override
protected IClassLoader makeNewClassLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent,
AnalysisScope scope) throws IOException {
if (classLoaderReference.equals(JavaSourceAnalysisScope.SOURCE)) {
ClassLoaderImpl cl = new PolyglotSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha,
getExtensionFor(classLoaderReference));
cl.init(scope.getModules(classLoaderReference));
return cl;
} else {
return super.makeNewClassLoader(classLoaderReference, cha, parent, scope);
}
}
}

View File

@ -0,0 +1,243 @@
/******************************************************************************
* Copyright (c) 2002 - 2014 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.java.translator.polyglot;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import polyglot.types.ArrayType;
import polyglot.types.ClassType;
import polyglot.types.CodeInstance;
import polyglot.types.ConstructorInstance;
import polyglot.types.FieldInstance;
import polyglot.types.InitializerInstance;
import polyglot.types.MemberDef;
import polyglot.types.MethodInstance;
import polyglot.types.PrimitiveType;
import polyglot.types.ProcedureInstance;
import polyglot.types.Type;
import com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.IdentityMapper;
import com.ibm.wala.cast.java.types.JavaPrimitiveTypeMap;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.Descriptor;
import com.ibm.wala.types.FieldReference;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.Selector;
import com.ibm.wala.types.TypeName;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.strings.Atom;
/**
* Class responsible for mapping Polyglot type system objects representing types,
* methods and fields to the corresponding WALA TypeReferences, MethodReferences
* and FieldReferences. Used during translation and by clients to help correlate
* WALA analysis results to the various AST nodes.
* @author rfuhrer
*/
public class PolyglotIdentityMapper implements IdentityMapper<Type, CodeInstance, FieldInstance> {
private final Map<Type, TypeReference> fTypeMap = HashMapFactory.make();
private final Map<FieldInstance, FieldReference> fFieldMap = HashMapFactory.make();
private final Map<CodeInstance, MethodReference> fMethodMap = HashMapFactory.make();
/**
* Map from Polyglot local ClassTypes to their enclosing methods. Used by localTypeToTypeID().<br>
* Needed since Polyglot doesn't provide this information. (It doesn't need to, since it
* doesn't need to generate unambiguous names for such entities -- it hands the source
* off to javac to generate bytecode. It probably also wouldn't want to, since that would
* create back-pointers from Type objects in the TypeSystem to AST's.)
*/
protected Map<ClassType, CodeInstance> fLocalTypeMap = new LinkedHashMap<ClassType, CodeInstance>();
protected final ClassLoaderReference fClassLoaderRef;
public PolyglotIdentityMapper(ClassLoaderReference clr) {
fClassLoaderRef= clr;
}
@Override
public FieldReference getFieldRef(FieldInstance field) {
if (!fFieldMap.containsKey(field)) {
FieldReference ref= referenceForField(field);
fFieldMap.put(field, ref);
return ref;
}
return fFieldMap.get(field);
}
@Override
public TypeReference getTypeRef(Type type) {
if (!fTypeMap.containsKey(type)) {
TypeReference ref= referenceForType(type);
fTypeMap.put(type, ref);
return ref;
}
return fTypeMap.get(type);
}
@Override
public MethodReference getMethodRef(CodeInstance method) {
if (!fMethodMap.containsKey(method)) {
MethodReference sel= referenceForMethod(method);
fMethodMap.put(method, sel);
return sel;
}
return fMethodMap.get(method);
}
public void mapLocalAnonTypeToMethod(ClassType anonLocalType, CodeInstance owningProc) {
fLocalTypeMap.put(anonLocalType, owningProc);
}
/**
* Create a FieldReference for the given Polyglot FieldInstance.<br>
* N.B.: This method <b>does not canonicalize</b> the FieldReferences,
* but rather creates a new one for each call.
* You more likely want to call getFieldRef(). This method is exposed
* so that multiple Polyglot instances can use the translation services
* without having FieldInstances collide (producing the dreaded "we are
* TypeSystem_c but type Foo is from TypeSystem_c" exception).
*/
public FieldReference referenceForField(FieldInstance field) {
Type targetType= field.container();
Type fieldType= field.type();
TypeReference targetTypeRef= TypeReference.findOrCreate(fClassLoaderRef, typeToTypeID(targetType));
TypeReference fieldTypeRef= TypeReference.findOrCreate(fClassLoaderRef, typeToTypeID(fieldType));
Atom fieldName= Atom.findOrCreateUnicodeAtom(field.name().toString());
FieldReference fieldRef= FieldReference.findOrCreate(targetTypeRef, fieldName, fieldTypeRef);
return fieldRef;
}
/**
* Create a TypeReference for the given Polyglot Type.<br>
* N.B.: This method <b>does not canonicalize</b> the TypeReferences,
* but rather creates a new one for each call.
* You more likely want to call getTypeRef(). This method is exposed
* so that multiple Polyglot instances can use the translation services
* without having Types collide (producing the dreaded "we are
* TypeSystem_c but type Foo is from TypeSystem_c" exception).
*/
public TypeReference referenceForType(Type type) {
TypeName typeName= TypeName.string2TypeName(typeToTypeID(type));
TypeReference typeRef= TypeReference.findOrCreate(fClassLoaderRef, typeName);
return typeRef;
}
private Selector selectorForMethod(CodeInstance procInstance) {
Atom name=
(procInstance instanceof ConstructorInstance) ?
MethodReference.initAtom :
(procInstance instanceof InitializerInstance) ?
MethodReference.clinitName :
Atom.findOrCreateUnicodeAtom(((MethodInstance) procInstance).name().toString());
TypeName[] argTypeNames = null;
if (! (procInstance instanceof InitializerInstance)) {
List formalTypes = ((ProcedureInstance)procInstance).formalTypes();
int numArgs = formalTypes.size();
// Descriptor prefers null to an empty array
if (numArgs > 0) {
argTypeNames = new TypeName[numArgs];
int i = 0;
for(Iterator iter = formalTypes.iterator(); iter.hasNext(); i++) {
Type argType= (Type) iter.next();
argTypeNames[i]= TypeName.string2TypeName(typeToTypeID(argType));
}
}
}
Type retType=
(procInstance instanceof MethodInstance) ? ((MethodInstance) procInstance).returnType() : procInstance.typeSystem().Void();
TypeName retTypeName= TypeName.string2TypeName(typeToTypeID(retType));
Descriptor desc= Descriptor.findOrCreate(argTypeNames, retTypeName);
return new Selector(name, desc);
}
/**
* Create a MethodReference for the given Polyglot MethodInstance.<br>
* N.B.: This method <b>does not canonicalize</b> the MethodReferences,
* but rather creates a new one for each call.
* You more likely want to call getMethodRef(). This method is exposed
* so that multiple Polyglot instances can use the translation services
* without having MethodInstances collide (producing the dreaded "we are
* TypeSystem_c but type Foo is from TypeSystem_c" exception).
*/
public MethodReference referenceForMethod(CodeInstance procInstance) {
// Handles both ConstructorInstance's and MethodInstance's
TypeName ownerType= TypeName.string2TypeName(typeToTypeID(((MemberDef) procInstance.def()).container().get()));
TypeReference ownerTypeRef= TypeReference.findOrCreate(fClassLoaderRef, ownerType);
MethodReference methodRef= MethodReference.findOrCreate(ownerTypeRef, selectorForMethod(procInstance));
return methodRef;
}
/**
* Translates the given Polyglot type to a name suitable for use in a WALA TypeReference
* (i.e. a bytecode-compliant type name).
*/
public String typeToTypeID(Type type) {
if (type.isPrimitive()) {
PrimitiveType ptype= (PrimitiveType) type;
return JavaPrimitiveTypeMap.getShortName(ptype.name().toString());
} else if (type.isArray()) {
ArrayType atype= (ArrayType) type;
return "[" + typeToTypeID(atype.base());
} else if (type.isNull()) {
Assertions.UNREACHABLE("typeToTypeID() encountered a null type!");
return null;
}
Assertions.productionAssertion(type.isClass(), "typeToTypeID() encountered the type " + type + " that is neither primitive, array, nor class!");
ClassType ctype= (ClassType) type;
return (ctype.isLocal() || ctype.isAnonymous()) ? anonLocalTypeToTypeID(ctype) : composeWALATypeDescriptor(ctype);
}
public String anonLocalTypeToTypeID(ClassType ctype) {
CodeInstance procInstance= fLocalTypeMap.get(ctype);
String outerTypeID= typeToTypeID(ctype.outer());
String shortName= (ctype.isAnonymous()) ? PolyglotJava2CAstTranslator.anonTypeName(ctype) : ctype.fullName().name().toString();
return outerTypeID + '/' + getMethodRef(procInstance).getSelector() + '/' + shortName;
}
public String composeWALATypeDescriptor(ClassType ctype) {
return "L" + composeWALATypeName(ctype);
}
public String composeWALATypeName(ClassType ctype) {
if (ctype.package_() != null) {
String packageName = ctype.package_().fullName().toString();
Assertions.productionAssertion(ctype.fullName().toString().startsWith(packageName));
return packageName.replace('.','/') + "/" + ctype.fullName().toString().substring( packageName.length()+1 ).replace('.','$');
} else {
return ctype.fullName().toString().replace('.', '$');
}
}
}

View File

@ -8,18 +8,21 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.wala.cast.java.client;
package com.ibm.wala.cast.java.translator.polyglot;
import com.ibm.wala.cast.java.translator.jdt.ecj.ECJClassLoaderFactory;
import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
import com.ibm.wala.classLoader.ClassLoaderFactory;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.util.config.SetOfClasses;
public class ECJJavaSourceAnalysisEngine<I extends InstanceKey> extends JavaSourceAnalysisEngine<I> {
public class PolyglotJavaSourceAnalysisEngine extends JavaSourceAnalysisEngine {
public IRTranslatorExtension getTranslatorExtension() {
return new JavaIRTranslatorExtension();
}
@Override
protected ClassLoaderFactory getClassLoaderFactory(SetOfClasses exclusions) {
return new ECJClassLoaderFactory(exclusions);
return new PolyglotClassLoaderFactory(exclusions, getTranslatorExtension());
}
}

View File

@ -0,0 +1,43 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
/*
* Created on Oct 7, 2005
*/
package com.ibm.wala.cast.java.translator.polyglot;
import java.io.IOException;
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.config.SetOfClasses;
public class PolyglotSourceLoaderImpl extends JavaSourceLoaderImpl {
protected final IRTranslatorExtension fExtInfo;
public PolyglotSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions,
IClassHierarchy cha, IRTranslatorExtension extInfo) throws IOException {
super(loaderRef, parent, exclusions, cha);
this.fExtInfo = extInfo;
}
public IRTranslatorExtension getTranslatorExtension() {
return fExtInfo;
}
@Override
protected SourceModuleTranslator getTranslator() {
return new PolyglotSourceModuleTranslator(cha.getScope(), fExtInfo, this, JavaSourceAnalysisScope.SOURCE);
}
}

View File

@ -0,0 +1,156 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
package com.ibm.wala.cast.java.translator.polyglot;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import polyglot.frontend.Compiler;
import polyglot.frontend.ExtensionInfo;
import polyglot.frontend.Globals;
import polyglot.frontend.Source;
import polyglot.main.Options;
import polyglot.main.UsageError;
import polyglot.util.ErrorInfo;
import polyglot.util.Position;
import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.classLoader.DirectoryTreeModule;
import com.ibm.wala.classLoader.FileModule;
import com.ibm.wala.classLoader.JarFileModule;
import com.ibm.wala.classLoader.Module;
import com.ibm.wala.classLoader.ModuleEntry;
import com.ibm.wala.classLoader.SourceFileModule;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.debug.Assertions;
/**
* A SourceModuleTranslator whose implementation of loadAllSources() uses a suitably
* configured Polyglot-based compiler to generate WALA IR for the sources in the
* compile-time classpath.
* @author rfuhrer
*/
public class PolyglotSourceModuleTranslator implements SourceModuleTranslator {
private final ExtensionInfo fExtInfo;
/**
* A client-supplied ClassLoaderReference to identify the innermost class loader
* to use when populating the classpath with loader Modules.
*/
private final ClassLoaderReference fSearchPathStart;
protected String fClassPath;
protected String fSourcePath;
public PolyglotSourceModuleTranslator(AnalysisScope scope, IRTranslatorExtension extInfo,
PolyglotSourceLoaderImpl sourceLoader, ClassLoaderReference searchPathStart) {
fSearchPathStart = searchPathStart;
fExtInfo= (ExtensionInfo) extInfo;
computeClassPath(scope);
computeSourcePath(scope);
extInfo.setSourceLoader(sourceLoader);
}
protected void computeClassPath(AnalysisScope scope) {
StringBuilder sb= new StringBuilder();
ClassLoaderReference cl= fSearchPathStart;
while (cl != null) {
addModulesForLoader(scope, cl, sb);
cl= cl.getParent();
}
fClassPath= sb.toString();
}
protected void addModulesForLoader(AnalysisScope scope, ClassLoaderReference cl, StringBuilder sb) {
for(Module m: scope.getModules(cl)) {
if (sb.length() > 0)
sb.append(File.pathSeparator);
if (m instanceof JarFileModule) {
JarFileModule jarFileModule= (JarFileModule) m;
sb.append(jarFileModule.getAbsolutePath());
} else if (m instanceof DirectoryTreeModule) {
DirectoryTreeModule directoryTreeModule= (DirectoryTreeModule) m;
sb.append(directoryTreeModule.getPath());
} else if (m instanceof FileModule) {
// do nothing
} else
Assertions.UNREACHABLE("Module entry is neither jar file nor directory");
}
}
protected void computeSourcePath(AnalysisScope scope) {
// Ordinarily, the source files to process are specified using absolute paths (see
// loadAllSources()), so the source path won't be needed. However, derived classes
// may choose to place entries on the source path to resolve source entities that
// were not explicitly specified. E.g., the X10 1.7 runtime jar contains source
// code, since class files don't contain all of the necessary type information.
// Given all of the above, the following value will either be correct or do no
// harm (even if the source path isn't used).
fSourcePath = ".";
}
@Override
public void loadAllSources(Set<ModuleEntry> modules) {
Options opts= fExtInfo.getOptions();
opts.assertions = true;
try {
opts.parseCommandLine(new String[] { "-noserial", "-cp", fClassPath, "-sourcepath", fSourcePath }, new HashSet<String>());
} catch (UsageError e) {
// Assertions.UNREACHABLE("Error parsing classpath spec???");
}
Compiler compiler= new Compiler(fExtInfo);
List<Source> streams= new ArrayList<Source>();
Globals.initialize(compiler);//PORT1.7 Must initialize before actually calling compiler
// N.B.: 'modules' is a flat set of source file ModuleEntry's.
for(Iterator<ModuleEntry> it= modules.iterator(); it.hasNext(); ) {
SourceFileModule entry= (SourceFileModule) it.next();
Assertions.productionAssertion(entry.isSourceFile());
if (skipSourceFile(entry)) {
continue;
}
try {
ModuleSource srcStream= new ModuleSource(entry);
streams.add(srcStream);
} catch (IOException e) {
compiler.errorQueue().enqueue(new ErrorInfo(ErrorInfo.IO_ERROR, "Unable to open source file '" + entry.getName() + "'", Position.COMPILER_GENERATED));
}
}
compiler.compile(streams);
// At this point, WALA now "knows" about all the source-originated stuff
}
/**
* @return true if the given source file module should not be processed,
* e.g. because it is generated on behalf of some upstream source.
*/
protected boolean skipSourceFile(SourceFileModule entry) {
return false;
}
}

View File

@ -0,0 +1,110 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
/*
* Created on Sep 28, 2005
*/
package com.ibm.wala.cast.java.translator.polyglot;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import polyglot.types.ArrayType;
import polyglot.types.ClassType;
import polyglot.types.ObjectType;
import polyglot.types.PrimitiveType;
import polyglot.types.Type;
import polyglot.types.TypeSystem;
import com.ibm.wala.cast.java.types.JavaPrimitiveTypeMap;
import com.ibm.wala.cast.tree.CAstType;
import com.ibm.wala.cast.tree.impl.CAstTypeDictionaryImpl;
import com.ibm.wala.util.debug.Assertions;
public class PolyglotTypeDictionary extends CAstTypeDictionaryImpl {
private final class PolyglotJavaArrayType implements CAstType.Array {
private final Type fEltPolyglotType;
private final CAstType fEltCAstType;
private PolyglotJavaArrayType(ArrayType arrayType) {
super();
fEltPolyglotType = arrayType.base();
fEltCAstType = getCAstTypeFor(fEltPolyglotType);
}
@Override
public int getNumDimensions() {
return 1; // always 1 for Java
}
@Override
public CAstType getElementType() {
return fEltCAstType;
}
@Override
public String getName() {
return "[" + fEltCAstType.getName();
}
@Override
public Collection<CAstType> getSupertypes() {
if (fEltPolyglotType.isPrimitive())
return Collections.singleton(getCAstTypeFor(fTypeSystem.Object()));
Assertions.productionAssertion(fEltPolyglotType.isReference(), "Non-primitive, non-reference array element type!");
ObjectType baseRefType = (ObjectType) fEltPolyglotType;
Collection<CAstType> supers = new ArrayList<CAstType>();
for (Iterator<Type> superIter = baseRefType.interfaces().iterator(); superIter.hasNext(); ) {
supers.add(getCAstTypeFor(superIter.next()));
}
if (baseRefType instanceof ClassType) {
ClassType baseClassType = (ClassType) baseRefType;
if (baseClassType.superClass() != null)
supers.add(getCAstTypeFor(baseRefType.superClass()));
}
return supers;
}
}
protected final TypeSystem fTypeSystem;
protected final PolyglotJava2CAstTranslator fTranslator;
public PolyglotTypeDictionary(TypeSystem typeSystem, PolyglotJava2CAstTranslator translator) {
fTypeSystem = typeSystem;
fTranslator = translator;
}
@Override
public CAstType getCAstTypeFor(Object astType) {
CAstType type = super.getCAstTypeFor(astType);
// Handle the case where we haven't seen an AST decl for some type before
// processing a reference. This can certainly happen with classes in byte-
// code libraries, for which we never see an AST decl.
// In this case, just create a new type and return that.
if (type == null) {
final Type polyglotType = (Type) astType;
if (polyglotType.isClass())
type = fTranslator.new PolyglotJavaType((ClassType) astType, this, fTypeSystem);
else if (polyglotType.isPrimitive()) {
type = JavaPrimitiveTypeMap.lookupType(((PrimitiveType) polyglotType).name().toString());
} else if (polyglotType.isArray()) {
type = new PolyglotJavaArrayType((ArrayType) polyglotType);
} else
Assertions.UNREACHABLE("getCAstTypeFor() passed type that is not primitive, array, or class?");
super.map(astType, type);
}
return type;
}
}

View File

@ -0,0 +1,37 @@
/*******************************************************************************
* 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.java.translator.polyglot;
import com.ibm.wala.cast.tree.CAst;
import com.ibm.wala.cast.tree.rewrite.AstLoopUnwinder;
import com.ibm.wala.cast.tree.rewrite.CAstRewriter;
import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
public class PolyglotUnwoundIRTranslatorExtension
extends JavaIRTranslatorExtension
{
private final int unrollDepth;
public PolyglotUnwoundIRTranslatorExtension(int unrollDepth) {
this.unrollDepth = unrollDepth;
}
@Override
public CAstRewriterFactory<CAstRewriter.RewriteContext<AstLoopUnwinder.UnwindKey>,AstLoopUnwinder.UnwindKey> getCAstRewriterFactory() {
return new CAstRewriterFactory<CAstRewriter.RewriteContext<AstLoopUnwinder.UnwindKey>,AstLoopUnwinder.UnwindKey>() {
@Override
public AstLoopUnwinder createCAstRewriter(CAst ast) {
return new AstLoopUnwinder(ast, true, unrollDepth);
}
};
}
}

View File

@ -0,0 +1,192 @@
/******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
/*
* Created on Sep 1, 2005
*/
package com.ibm.wala.cast.java.translator.polyglot;
import polyglot.ast.ArrayAccess;
import polyglot.ast.ArrayAccessAssign;
import polyglot.ast.ArrayInit;
import polyglot.ast.ArrayTypeNode;
import polyglot.ast.Assert;
import polyglot.ast.Binary;
import polyglot.ast.Block;
import polyglot.ast.BooleanLit;
import polyglot.ast.Branch;
import polyglot.ast.Call;
import polyglot.ast.CanonicalTypeNode;
import polyglot.ast.Case;
import polyglot.ast.Cast;
import polyglot.ast.Catch;
import polyglot.ast.CharLit;
import polyglot.ast.ClassBody;
import polyglot.ast.ClassDecl;
import polyglot.ast.ClassLit;
import polyglot.ast.Conditional;
import polyglot.ast.ConstructorCall;
import polyglot.ast.ConstructorDecl;
import polyglot.ast.Do;
import polyglot.ast.Empty;
import polyglot.ast.Eval;
import polyglot.ast.Field;
import polyglot.ast.FieldAssign;
import polyglot.ast.FieldDecl;
import polyglot.ast.FloatLit;
import polyglot.ast.For;
import polyglot.ast.Formal;
import polyglot.ast.If;
import polyglot.ast.Import;
import polyglot.ast.Initializer;
import polyglot.ast.Instanceof;
import polyglot.ast.IntLit;
import polyglot.ast.Labeled;
import polyglot.ast.Local;
import polyglot.ast.LocalAssign;
import polyglot.ast.LocalClassDecl;
import polyglot.ast.LocalDecl;
import polyglot.ast.MethodDecl;
import polyglot.ast.New;
import polyglot.ast.NewArray;
import polyglot.ast.NullLit;
import polyglot.ast.PackageNode;
import polyglot.ast.Return;
import polyglot.ast.Special;
import polyglot.ast.StringLit;
import polyglot.ast.Switch;
import polyglot.ast.SwitchBlock;
import polyglot.ast.Synchronized;
import polyglot.ast.Throw;
import polyglot.ast.Try;
import polyglot.ast.Unary;
import polyglot.ast.While;
import com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.MethodContext;
import com.ibm.wala.cast.java.translator.polyglot.PolyglotJava2CAstTranslator.WalkContext;
import com.ibm.wala.cast.tree.CAstNode;
/**
* An alternative visitor API for Polyglot, whose API is somewhat brain-damaged...
*
* @author rfuhrer
*/
public interface TranslatingVisitor {
CAstNode visit(MethodDecl m, MethodContext context);
CAstNode visit(ConstructorDecl cd, MethodContext cc);
CAstNode visit(FieldDecl f, MethodContext mc); // yes, a MethodContext; we process FieldDecl's only to add their initializers to
// each constructor
CAstNode visit(Import i, WalkContext wc);
CAstNode visit(PackageNode p, WalkContext wc);
CAstNode visit(CanonicalTypeNode ctn, WalkContext wc);
CAstNode visit(ArrayTypeNode ctn, WalkContext wc);
CAstNode visit(ArrayInit ai, WalkContext wc);
CAstNode visit(ArrayAccessAssign aaa, WalkContext wc);
CAstNode visit(FieldAssign fa, WalkContext wc);
CAstNode visit(LocalAssign la, WalkContext wc);
CAstNode visit(Binary b, WalkContext wc);
CAstNode visit(Call c, WalkContext wc);
CAstNode visit(ConstructorCall cc, WalkContext wc);
CAstNode visit(Cast c, WalkContext wc);
CAstNode visit(Conditional c, WalkContext wc);
CAstNode visit(Instanceof io, WalkContext wc);
CAstNode visit(BooleanLit bl, WalkContext wc);
CAstNode visit(ClassLit cl, WalkContext wc);
CAstNode visit(FloatLit fl, WalkContext wc);
CAstNode visit(NullLit nl, WalkContext wc);
CAstNode visit(CharLit cl, WalkContext wc);
CAstNode visit(IntLit il, WalkContext wc);
CAstNode visit(StringLit sl, WalkContext wc);
CAstNode visit(New n, WalkContext wc);
CAstNode visit(NewArray na, WalkContext wc);
CAstNode visit(Special s, WalkContext wc);
CAstNode visit(Unary u, WalkContext wc);
CAstNode visit(ArrayAccess aa, WalkContext wc);
CAstNode visit(Field f, WalkContext wc);
CAstNode visit(Local l, WalkContext wc);
CAstNode visit(ClassBody cb, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(ClassDecl cd, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(Initializer i, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(Assert a, WalkContext wc);
CAstNode visit(Branch b, WalkContext wc);
CAstNode visit(Block b, WalkContext wc);
CAstNode visit(SwitchBlock sb, WalkContext wc);
CAstNode visit(Catch c, WalkContext wc);
CAstNode visit(If i, WalkContext wc);
CAstNode visit(Labeled l, WalkContext wc);
CAstNode visit(LocalClassDecl lcd, WalkContext wc);
CAstNode visit(Do d, WalkContext wc);
CAstNode visit(For f, WalkContext wc);
CAstNode visit(While w, WalkContext wc);
CAstNode visit(Switch s, WalkContext wc);
CAstNode visit(Synchronized s, WalkContext wc);
CAstNode visit(Try t, WalkContext wc);
CAstNode visit(Empty e, WalkContext wc);
CAstNode visit(Eval e, WalkContext wc);
CAstNode visit(LocalDecl ld, WalkContext wc);
CAstNode visit(Return r, WalkContext wc);
CAstNode visit(Case c, WalkContext wc);
CAstNode visit(Throw t, WalkContext wc);
CAstNode visit(Formal f, WalkContext wc); // may not see these (might be handled by parent)
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,103 @@
/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

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.java.test.data</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/java.test.data JLex download.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -1,46 +1,41 @@
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
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.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
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.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=error
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
@ -48,9 +43,9 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
@ -62,66 +57,56 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=ignore
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
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=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
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.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=ignore
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0

View File

@ -1,32 +0,0 @@
compilers.f.unresolved-features=1
compilers.f.unresolved-plugins=1
compilers.incompatible-environment=1
compilers.p.build=1
compilers.p.build.bin.includes=1
compilers.p.build.encodings=1
compilers.p.build.java.compiler=0
compilers.p.build.java.compliance=1
compilers.p.build.missing.output=1
compilers.p.build.output.library=1
compilers.p.build.source.library=1
compilers.p.build.src.includes=1
compilers.p.deprecated=1
compilers.p.discouraged-class=1
compilers.p.internal=1
compilers.p.missing-packages=2
compilers.p.missing-version-export-package=1
compilers.p.missing-version-import-package=1
compilers.p.missing-version-require-bundle=1
compilers.p.no-required-att=0
compilers.p.not-externalized-att=1
compilers.p.unknown-attribute=1
compilers.p.unknown-class=1
compilers.p.unknown-element=1
compilers.p.unknown-identifier=1
compilers.p.unknown-resource=1
compilers.p.unresolved-ex-points=0
compilers.p.unresolved-import=0
compilers.s.create-docs=false
compilers.s.doc-folder=doc
compilers.s.open-tags=1
eclipse.preferences.version=1

View File

@ -1,10 +0,0 @@
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorList
USER_MANUAL_PREFERENCE=enabledManualValidatorList
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.700.v201610061600
eclipse.preferences.version=1
override=true
suspend=false
vals/org.eclipse.wst.html.core.HTMLValidator/groups=0107include06111contentType136org.eclipse.wst.html.core.htmlsourceT07fileext04htmlF07fileext05xhtmlF07fileext03htmF07fileext04htplF07fileext03wmlF0107exclude0104file139target/site/dependency-convergence.htmlT03
vals/org.eclipse.wst.xml.core.xml/groups=0107include05111contentType128org.eclipse.core.runtime.xmlT111contentType134org.eclipse.wst.xml.core.xmlsourceT111contentType134org.eclipse.wst.xml.core.xslsourceT111contentType134org.eclipse.jst.jsp.core.tldsourceT07fileext03xmlF0107exclude08113projectNature134org.eclipse.jst.j2ee.ejb.EJBNature113projectNature130org.eclipse.jst.j2ee.EARNature04file08.projectT0104file110.classpathT0104file110.settings/T0204file122target/p2artifacts.xmlT0304file120target/p2content.xmlT0304file128target/antrun/build-main.xmlT03
vf.version=3

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Name: Data Plug-in
Bundle-SymbolicName: com.ibm.wala.cast.java.test.data
Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Version: 1.3.8.qualifier
Bundle-Vendor: IBM
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

View File

@ -1,3 +0,0 @@
#Properties file for com.ibm.wala.cast.java.test.data
Bundle-Vendor = IBM
Bundle-Name = Data Plug-in

View File

@ -1,35 +0,0 @@
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]) {
}

View File

@ -1,7 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true
.

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="com.ibm.wala.cast.java.test.data" default="jar" basedir=".">
<property name="basews" value="${ws}"/>
@ -13,8 +12,8 @@
<property name="javacVerbose" value="false"/>
<property name="logExtension" value=".log"/>
<property name="compilerArg" value=""/>
<property name="javacSource" value="1.8"/>
<property name="javacTarget" value="1.8"/>
<property name="javacSource" value="1.7"/>
<property name="javacTarget" value="1.7"/>
<!-- This property has been updated to correspond to the paths used by the latest Java update
on Mac OS X 10.6 (Java version 1.6.0_22). If you are not using this version of Mac OS X or Java,
try changing the value of the property to "${java.home}/../../../Classes" -->

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.wala</groupId>
<artifactId>WALA</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.3.8-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.java.test.data</artifactId>
<packaging>eclipse-plugin</packaging>

View File

@ -15,15 +15,13 @@ public class AnonymousClass {
}
public static void main(String[] args) {
final Integer base = Integer.valueOf(6);
final Integer base = new Integer(6);
Foo f= new Foo() {
int value = 3;
@Override
public int getValue() { return value; }
@Override
public int getValueBase() { return value - base.intValue(); }
};
@ -34,13 +32,12 @@ public class AnonymousClass {
}
public void method() {
final Integer base = Integer.valueOf(7);
final Integer base = new Integer(7);
abstract class FooImpl implements Foo {
int y;
@Override
public abstract int getValue();
FooImpl(int _y) {
@ -48,7 +45,6 @@ public class AnonymousClass {
}
@Override
public int getValueBase() {
return y + getValue() - base.intValue();
}
@ -56,7 +52,6 @@ public class AnonymousClass {
Foo f= new FooImpl(-4) {
@Override
public int getValue() { return 7; }
};

View File

@ -26,4 +26,4 @@ public class Array1 {
sum += ary[j];
}
}
}
}

View File

@ -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", Integer.valueOf(55), new int[] { 3, 1, 4 } };
Object[] b= new Object[] { null, "hi", new Integer(55), new int[] { 3, 1, 4 } };
}
}
}

View File

@ -42,4 +42,4 @@ public class Breaks {
(new Breaks()).testBreakFromIf("whatever", new Ref(args));
}
}
}

View File

@ -34,4 +34,4 @@ public class Casts {
int i2 = i1 + s1;
}
}
}

View File

@ -15,7 +15,6 @@ import java.io.IOException;
public final class Exception2 {
@SuppressWarnings("resource")
public static void main(String[] args) {
Exception2 e2= new Exception2();
FileInputStream fis = null;

View File

@ -22,7 +22,6 @@ public class FunkySupers {
class SubFunkySupers extends FunkySupers {
@Override
int funky(FunkySupers fs) {
SubFunkySupers.super.funky(fs);
SubFunkySupers.this.funky(fs);
@ -36,4 +35,4 @@ class SubFunkySupers extends FunkySupers {
//class EE { class X {} }
//class Y extends EE.X { Y(EE e) { e.super(); } }
// DOESNT WORK IN POLYGLOT!!!
// DOESNT WORK IN POLYGLOT!!!

View File

@ -30,13 +30,11 @@ class Base {
}
class Derived extends Base {
@Override
public void foo() {
super.foo();
}
@Override
public String bar(int x) {
return Integer.toHexString(x);
}
}
}

View File

@ -32,7 +32,6 @@ public class InnerClassLexicalReads {
* 1 return v2:com.ibm.wala.ssa.SymbolTable$1@16b18b6[11:4] -> [11:13]
*/
@Override
public int getConstant() {
return y;
}

View File

@ -26,4 +26,4 @@ class Sub extends InnerClassSuper {
so.test();
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More