Compare commits

...

610 Commits

Author SHA1 Message Date
Achim D. Brucker d28d21d820 Added DASCA version postfix. 2018-10-23 21:00:48 +01:00
Achim D. Brucker c285cc72d2 Moved resource declaration into try-statement. 2018-10-21 20:20:13 +01:00
Achim D. Brucker d53814e154 Restored error level for org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable. 2018-10-21 18:29:40 +01:00
Achim D. Brucker 3d5dec0b0c Manual merge. 2018-10-21 16:31:25 +01:00
Julian Dolby 2d2d6070ff more talking 2018-10-20 12:16:43 -04:00
Julian Dolby 8381141e54 try out instead of err output 2018-10-19 22:31:10 -04:00
Julian Dolby a1649be85b talk to Travis 2018-10-18 23:23:24 -04:00
Julian Dolby 869ca81272 more memory, parallelism for tests 2018-10-18 22:55:13 -04:00
Julian Dolby 38c5de6160 fix for forName selector: use the CHA in getRelevantParameters to resolve
the declared target of the call site.  This is needed to make sure
forName targets loaded with the Application loader get resolved to point
to the real metod reference for forName.

this issue actually manifested itself in the Kawa Chess program, and so
I have added an assertion to make sure this resolution is done properly.
2018-10-18 22:25:21 -04:00
Julian Dolby 533d392bda support for method argument default values 2018-10-17 19:44:44 -04:00
Julian Dolby 948d69cbb8 fix for Soot: trim instruction array to avoid nulls 2018-10-16 21:43:26 -04:00
Julian Dolby d690d94cdd more use for object literals 2018-10-16 00:34:31 -04:00
Julian Dolby bf3c419e1c test for presence of nodes in Kawa chess test that need method handles
and string constants to play nicely together.
2018-10-15 02:12:42 -04:00
Julian Dolby 89492c28fa more heap space for tests 2018-10-13 09:27:38 -04:00
Julian Dolby b2503628a4 1) a bit more source mappimg information
2) fixes to how Contexts are combined
2018-10-13 08:42:08 -04:00
Julian Dolby 31cf42674a Merge branch 'master' of github.com:wala/WALA 2018-10-03 09:02:26 -04:00
Julian Dolby 7a7d341c94 merge 2018-10-03 09:02:07 -04:00
Erik Derr 018e9d20eb Fixes Exception in AndroidAnalysisScope (#361)
Fixes inconsistent behavior of the exclusions argument.
Depending on the androidLib argument, setting exclusions to null
is either fine or raises and exception.

This patch makes exclusions truely optional for any case
when null is passed.
2018-10-02 22:29:44 -07:00
Erik Derr ee13713c4d Impl of IMethod.is(Wala)Synthetic and IClass.isSynthetic (#359)
* Impl of IMethod isSynthetic and isWalaSynthetic

So far IMethod.isSynthetic referred to WALA-generated helper functions
and there was no equivalent to check whether an IMethod is synthetic in
terms of compiler-generated.

To make naming consistent this patch first renames the isSynthetic to
isWalaSynthetic to clearly indicate that a given IMethod was generated
by WALA. Then, we re-introduce isSynthetic that from now on checks
whether an IMethod is synthetic/compiler-generated (referring to the
synthetic flag in bytecode)

* Implementation of IClass.isSynthetic

Complementary to IMethod.isSynthetic, this method checks whether
an IClass is compiler-generated.

* updated JavaDoc
2018-10-02 22:28:21 -07:00
Erik Derr 751444a656 Fixes IllegalStateException (#358)
* Fixes IllegalStateException

Reverts refactored code with try-with-resource back to potentially
leaking implementation. The refactored code threw an exception since
JarFileModule does not implement the AutoClosable interface. Further,
removed the printStackTrace() call, as this is not an exceptional case
but intended control-flow in case DexFileModule creation fails.

* Downgrade JarFile leak diagnostic from warning to error

This is consistent with how we are treating potential JarFile leaks in
other WALA components.  WALA issue #236 already notes that these
should be cleaned up eventually, although doing so will not be easy.
2018-09-30 12:19:14 -07:00
Sifis Lagouvardos 6fd67b886e Added multidex apk file in dalvik.test/data and a new test for multidex apk files. 2018-09-21 19:08:06 -07:00
Sifis Lagouvardos 819e7e1a7f Added test for the new DexFileModule constructor that supports specific .dex files. 2018-09-21 19:08:06 -07:00
Sifis Lagouvardos 2ab002df3e Added new DexFileModule constructor to support specific dex files inside apks. 2018-09-21 19:08:06 -07:00
Julian Dolby 1867b57425 move utility so other tests can use it 2018-09-20 14:48:06 -04:00
Julian Dolby 1c6a6b0cbd
Merge pull request #352 from sifislag/master
Added a CAstNode and a CAstOperator to support some wanted python features.
2018-09-12 15:55:57 -04:00
Sifis Lagouvardos be0ef4e16b Added CAstOperator to support the not in operation in Python. 2018-09-12 18:25:21 +03:00
Sifis Lagouvardos 9ce10ab5b9 Added GLOBAL_DECL CAstNode for the python global statement. 2018-09-12 18:21:00 +03:00
Julian Dolby b32704b8a3 Merge branch 'master' of github.com:wala/WALA 2018-09-11 13:57:32 -04:00
Julian Dolby 7f47c7200a dexlib -> 2.2.5 2018-09-11 13:43:07 -04:00
Julian Dolby e4f62978cb comment out non-working test; it seems to look at a URL that no longer
works
2018-09-11 13:39:06 -04:00
Julian Dolby e85f01b2b3 fix for Dalvik instruction generation 2018-09-11 13:36:29 -04:00
Julian Dolby d13a38fbe1
Merge pull request #345 from SunghoLee/master
Fix the comparison method for ConstantKey
2018-08-27 21:47:46 -04:00
Sungho Lee 2640b97b5d Fix comparison method for ConstantKey 2018-08-28 09:47:09 +09:00
Julian Dolby 762389c315
Merge pull request #344 from bryantam/cast_constant-h-add-changes
add missing CAstNodeType to cast_constant.h that are defined in CAstNode
2018-08-26 22:35:58 -04:00
Bryan Tam 6f317bc9fa add missing CAstNodeType to cast_constant.h that are defined in CAstNode 2018-08-23 21:16:24 -04:00
Manu Sridharan 49628fdf44 Start new development version 2018-08-22 12:01:19 -07:00
Manu Sridharan 6b46ce4faa Version 1.5.0 2018-08-22 11:19:51 -07:00
Manu Sridharan 5d7b4d5988 Update change-version.py to handle build.gradle, and clean it up 2018-08-22 09:51:54 -07:00
Julian Dolby c40c7e34f0
Merge pull request #340 from liblit/assorted-gradle-test-fixes
Assorted Gradle test fixes
2018-08-11 16:53:41 -04:00
Ben Liblit 32795455fb Avoid redundant copying of some test resources
These specific test resources are already included in the "testArchives"
configuration of the "com.ibm.wala.core.tests" subproject, upon which
the "com.ibm.wala.dalvik.test" tests already depend.  So there's no need
to also copy these resources into the "com.ibm.wala.dalvik.test" test
resources area as well.
2018-08-11 12:40:44 -05:00
Ben Liblit d9f7abdad3 Augment cleanTest tasks rather than replacing them
Previously I hadn't realized that Gradle's "java" plugin would generate
default "cleanTest" tasks for us.  By defining my own "cleanTest" tasks
we were replacing the generated ones, but what we really wanted to do
was augment them with additional files to delete.
2018-08-11 12:36:22 -05:00
Julian Dolby d92c732dec fix more osx builds 2018-08-08 21:53:41 -05:00
Julian Dolby be7b0deb5f
Merge pull request #338 from liblit/kawa-gradle-improvements
Improvements for Kawa- and JNI-related Gradle build tasks
2018-08-04 18:52:05 -04:00
Ben Liblit e4bb8f2246 Remove redundant "afterEclipseBuildshipImport" dependencies
Every dependency task listed here is already a dependency of at least
one subproject's "processTestResources" task, and each
"processTestResources" task already depends on the corresponding
"afterEclipseBuildshipImport" task.  So listing these tasks here too
is unnecessary.
2018-08-04 05:15:08 -05:00
Ben Liblit febf20145e Rework Kawa download and build tasks to be more Gradle'y
All Kawa-related downloads now use our existing VerifiedDownload task
class.  This gives us Gradle-integrated progress reporting,
incremental build support, build caching, correct dependencies, etc.

Using Kawa to compile Scheme into bytecode now also has proper
dependency management, incremental build support, and build caching.
Same goes for bundling these compiled bytecode files into jar archives
for later use in regression tests.

Also, when downloading kawa-chess, grab a specific commit hash rather
than whatever is the most recent master commit.  If this project
changes in the future, we don't want our tests to break unexpectedly.
Perhaps we'd want to pick up any new kawa-chess commits; perhaps not.
Either way, that should be a conscious decision rather than something
that can happen behind our backs.
2018-08-04 04:37:41 -05:00
Ben Liblit 8324a9cb56 Ignore downloaded "kawa-chess" subdirectory
This is not our source code.  It's just a clone of someone else's Git
repository.  Maven or Gradle will recreate it when asked to do so.
2018-08-04 04:35:30 -05:00
Ben Liblit a7cef8e77a Declare a task's outputs, enabling incremental build and caching
This specific task runs an external command, and we consider the task
successful if that command exits without error.  We don't actually
examine the stdout or stderr of the command being run.

However, it is still useful to log the stdout and stderr to a file,
and to declare that file to be the output of the task.  Otherwise, the
task has no declared outputs at all.  A task with no outputs is
ineligible for caching and is always considered to be out-of-date.

squash! Declare a task's outputs, enabling incremental build and caching
2018-08-04 04:29:59 -05:00
Julian Dolby e0ad8fd9f7 try Xcode version recommended by Travis 2018-08-03 16:21:03 -04:00
Julian Dolby c5cdb9e32a clean up MethodHandle support 2018-08-03 15:52:24 -04:00
Julian Dolby 25bb519221 set version for macos 2018-08-03 08:21:41 -04:00
Julian Dolby d54859f923 revert chnage 2018-08-03 00:29:29 -04:00
Julian Dolby 530c6d5bd7 put kawa.jar in proper place 2018-08-03 00:08:46 -04:00
Julian Dolby 768a546f19 try to force kawa compiles 2018-08-03 00:02:12 -04:00
Julian Dolby 01af1c6ddc try more kawa compile hacks 2018-08-02 23:21:47 -04:00
Julian Dolby 62931350eb try hacks for kawa 2018-08-02 22:56:15 -04:00
Julian Dolby b9400f816e copy kawa jar 2018-08-02 21:58:05 -04:00
Julian Dolby 82061c83e0 exclusions for GUI 2018-08-02 21:41:08 -04:00
Julian Dolby 415fd39f0d ant work 2018-08-02 21:20:06 -04:00
Julian Dolby 834927239c gradle work 2018-08-02 21:17:52 -04:00
Julian Dolby a4eb79edbe another try to fix gradle on travis 2018-08-02 20:21:18 -04:00
Julian Dolby 9af2e30262 try fix to gradle build 2018-08-02 20:08:21 -04:00
Julian Dolby e6136a0045 Merge branch 'master' of github.com:wala/WALA 2018-08-02 19:38:14 -04:00
Julian Dolby 7e6cfe84f6 more support for method handles, particularly for ones created with
reflection.
2018-08-02 19:35:32 -04:00
Ben Liblit cc2ba19b7c Categorize Eclipse sources as main vs. test
This leverages new Eclipse 4.8 (Photon) features that distinguish main
code from test code:
<https://www.eclipse.org/photon/noteworthy/index.php#test-sources>.
An eventual fix to <https://github.com/gradle/gradle/issues/4802>
might mean that Buildship starts doing this automatically, but for now
we can do it ourselves.

If using an older Eclipse release, this change does nothing useful,
but neither does it cause any harm.
2018-07-30 09:17:05 -07:00
Julian Dolby 0ad11fefc3 work on Wala with Yannis' group 2018-07-22 16:19:32 -04:00
Ben Liblit 8edfd285d7 Turn off a Gradle warning about Gradle 5.0 incompatibility
The issue here is a planned change to how "publishing" blocks work.
Per
<https://docs.gradle.org/4.9/userguide/publishing_maven.html#publishing_maven:deferred_configuration>,
the right way to prepare for this change is to enable it and check for
unexpected changes in what gets published to a local repository.  I
have done this, and find no unexpected changes.

So we are actually ready for Gradle 5.0; the warning is a false
positive for us.  Leaving the future change enabled means we won't
keep seeing this warning.  It also means that any further changes to
our use of "publishing" will be tested under that future change, which
is a good way to avoid surprises later.
2018-07-22 02:42:54 +02:00
Leo Li d15f49bd90 Add install_name when build libcast on macos. (#332)
Gradle won't pass absolute path when build libcast. We need to set install_name manually otherwise `dyld` would not able to find libcast at runtime.

This is only needed on macos since `ld` will look up all runtime search path automatically.
2018-07-22 02:42:19 +02:00
Ben Liblit bc3ea1a777 Fix a spelling error in a comment 2018-07-20 08:44:23 +02:00
Ben Liblit 2b2483abd6 Avoid dereferencing null if no C/C++ compiler is present
Fixes #328, which requested better diagnostic messages in the case of
a missing C/C++ compiler toolchain.  Gradle actually has perfectly
good, informative messages in that case.  Unfortunately, we were
killing the build by dereferencing null before Gradle had a chance to
explain.  Now we bail out of some setup work early to avoid the null
dereference, thereby letting Gradle explain things properly.
2018-07-20 08:44:23 +02:00
Ben Liblit 10d3adf324 Retry download task if the destination file is missing
Under some circumstances, Gradle seems to decide that the destination
file being absent is the download task's expected outcome.  It caches
this state, and refuses to retry the download in the future since it
thinks the task is up-to-date.  We can correct this by telling Gradle
that the task should not be considered up-to-date if the file is
missing, as recommended by
<https://discuss.gradle.org/t/task-up-to-date-but-outputfile-not-created/17568/2>.
2018-07-20 08:44:23 +02:00
Ben Liblit 0510c914bb Update Gradle wrapper to release 4.9
Gradle 4.9 has no new features of particular interest to us.  It's
good to stay up-to-date, though.
2018-07-20 08:44:23 +02:00
Ben Liblit 72e9ba31f8 Use more complete Gradle package for better IDE support
In particular, using the "all" package (which includes source) allows
IntelliJ IDEA to provide autocompletion and other nice features that
are unavailable when using the "bin" package.
2018-07-20 08:44:23 +02:00
Ben Liblit c242f6126c Publish all generated Java bytecode jar archives
Previously we were only publishing source archives.  This fixes
wala/WALA#326 if I got everything right on the first try.  More likely
is that we will need a few rounds of revision before it's all doing
what it should.  For example, we may need to customize aspects of the
Gradle-generated "*.pom" files as described at
<https://docs.gradle.org/current/userguide/publishing_maven.html#sec:identity_values_in_the_generated_pom>
and
<https://docs.gradle.org/current/userguide/publishing_maven.html#sec:modifying_the_generated_pom>.
2018-07-19 22:23:14 +02:00
Manu Sridharan 2b1d82d1bb Expand missing super test 2018-07-19 18:17:59 +02:00
Manu Sridharan a78af3f67e
Add API to add an InputStream for a jar to an AnalysisScope (#330)
This is useful, e.g., if you have the bytes of a jar file in memory and want to load it into an `AnalysisScope`.
2018-07-19 17:01:51 +02:00
Manu Sridharan aeb17dfca4
Allow for classes with missing superclasses in class hierarchy (#329)
Fixes #322 

We add an option `createPhantomSuperclasses` to `ClassHierarchy`.  When set, if a superclass is missing, we create a new `PhantomClass` in its place and allow the subclass to be added.

To use, you can create the `ClassHierarchy` with the new `ClassHierarchyFactory.makeWithPhantom` methods.
2018-07-19 16:10:35 +02:00
Julian Dolby 5edf49254c ore meta data 2018-07-19 14:02:04 +02:00
Julian Dolby fc261b6ee7 mata data 2018-07-19 13:51:06 +02:00
Julian Dolby 6e6b29339c latest dexlib 2018-07-19 12:45:17 +02:00
Julian Dolby 1bbca5a222 Merge branch 'master' of github.com:wala/WALA 2018-07-15 12:41:25 +02:00
Julian Dolby c5f812d784 fix script for python 3 2018-07-15 12:41:18 +02:00
Ben Liblit 1ac4ca9475 Tweaks and instructions for WALA as an IntelliJ IDEA project
We already had some IntelliJ IDEA project metadata files in ".idea".
I've revisited and updated those now that I have more experience with
Gradle + IntelliJ IDEA + Git.  I think this now represents a better
set of decisions regarding what does and does not belong in version
control.

This commit also extends "README-Gradle.md" with clear instructions on
how to bringup WALA as a top-level IntelliJ IDEA project.  The
instructions are of a similar flavor to the Eclipse instructions that
were already present, though the details vary.  Most notably, with
IntelliJ IDEA you should *open* WALA as an existing project,
not *import* it as a new Gradle project derived from "build.gradle".
This is exactly the reverse of what one should and shouldn't do for
WALA in Eclipse.
2018-07-12 14:52:13 -07:00
Julian Dolby ed59197ae3
Merge pull request #325 from liblit/miscellaneous-ide-updates
Miscellaneous IDE updates
2018-07-12 12:57:40 -04:00
Ben Liblit 858148e91b Reorganize how we deal with shared JavaScript test examples
When IntelliJ IDEA imports WALA's Gradle configuration, it creates
what is calls a "module" for each sourceSet of each Gradle subproject.
In so doing, it automatically picks up the source and resource
directories used by each of these sourceSets.  Unfortunately, IntelliJ
IDEA does not allow multiple modules to share a single root directory
as their source or resource directories, and that's exactly what was
going on with the "example-src" subdirectory under
"com.ibm.wala.cast.js.test.data".

This revised Gradle configuration still has is copying the necessary
"example-src" resources to the appropriate locations for use as test
resources.  But IntelliJ IDEA no longer treats "example-src" as a root
directory for resources in the automatically-generated modules.  So
now we get along nicer with IntelliJ IDEA while keeping everything
working with Gradle as well.
2018-07-11 16:13:05 -05:00
Ben Liblit 3d9e4d23d8 Add helper task for extra setup after opening in IntelliJ IDEA
This task serves a similar role to the "afterEclipseBuildshipImport"
task used with Eclipse.  It should only be necessary to build this
task once:  in a freshly checked-out tree, just after opening it for
the first time in IntelliJ IDEA.

Ideally this extra setup task would be triggered automatically using
the "Tasks Activation" feature of IntelliJ IDEA's Gradle support.
Unfortunately, "Tasks Activation" settings are recorded in
".idea/workspace.xml", which is used for non-revision-tracked personal
settings.
2018-07-11 15:13:39 -05:00
Ben Liblit 7c2189849f Add a stub JDT preferences file, originally created by Buildship 2018-07-11 15:11:44 -05:00
Julian Dolby dc47e1da98 add default methods to instruction visitors
relax dump api
2018-07-10 21:53:48 -04:00
Julian Dolby ef89dc5345 a little tolerance for sloppy models 2018-07-04 15:46:06 -04:00
Julian Dolby bc0309b5ba Merge branch 'master' of github.com:wala/WALA 2018-06-27 14:58:10 -04:00
Julian Dolby fe1247f2ce switch to rhino 1.7.10 2018-06-27 14:57:35 -04:00
Ben Liblit 6be7a1a8a2 Have Travis CI periodically try to build each subproject separately
If Gradle dependencies are set up correctly, then it should be
possible to build any subproject starting with a pristine tree.
These take too long to use for every commit, pull request, etc.  But
running an extensive test like this periodically (e.g., weekly) seems
reasonable.
2018-06-26 09:19:02 -07:00
Ben Liblit 36320a078c Upgrade Gradle wrapper to release 4.8.1
No significant changes in this release that affect us, but it's good
to stay up-to-date.
2018-06-26 08:31:59 -07:00
Julian Dolby 0752bf321c Merge branch 'master' of github.com:wala/WALA 2018-06-22 21:49:06 -04:00
Julian Dolby 37eea27f4a more support for out-of-order lexical declarations 2018-06-22 19:49:49 -04:00
Julian Dolby 4de0ed876d remove overly conservative assertion 2018-06-22 07:26:38 -04:00
Julian Dolby af639ec654
Merge pull request #319 from liblit/minor-tidying-up
Minor tidying up
2018-06-10 22:01:03 -04:00
Ben Liblit bc86a27e85 Remove a subproject ".gitignore" whose patterns no longer apply
Perhaps files once existed here that matched the given exclusion
patterns, but there are certainly no such files here now.
2018-06-09 18:46:11 -05:00
Ben Liblit 2fcd079fe2 Anchor many ignore patterns that only apply at the topmost level 2018-06-09 18:46:11 -05:00
Ben Liblit ddeb2bd8ab Ignore a Visual Studio Code settings file
The settings I am seeing in here so far seem like per-developer
preferences, not shared per-project configuration information.
2018-06-09 18:46:11 -05:00
Ben Liblit c4f127f371 Subproject "com.ibm.wala.cast.js.test.data" contains no Java code 2018-06-09 18:46:11 -05:00
Julian Dolby b1b09684bd
Merge pull request #317 from liblit/future-java-compatibility-fixes
Future Java compatibility fixes
2018-06-06 12:52:51 -04:00
Ben Liblit 5336a08af2 Avoid using deprecated boxing constructors
Boxing a primitive using the constructor ("new Integer(4)") always
creates a distinct new boxed instance.  That's rarely what you need,
and in fact all of those constructors have been deprecated in Java 9.
Using the static "valueOf" method instead ("Integer.valueOf(4)") can
give better performance by reusing existing instances.  You no longer
get a unique boxed object, but generally that's OK.
2018-06-05 14:44:59 -05:00
Julian Dolby 9aed4e058d more tracking of sourse positions for function parameters 2018-06-05 15:00:31 -04:00
Ben Liblit 32e105a3c0 Skip a specific test if offline; this test requires network access 2018-06-04 12:29:57 -05:00
Ben Liblit 5cf8b7efe3 Stop using deprecated "javah" to generate JNI headers
"javah" was deprecated in Java 9, and has been removed entirely in
Java 10.  The right way to generate headers now is by using the "-h"
flag to "javac".  When "javac" is run in this way, it still generates
bytecode too.  So ideally, we'd run "javac" just once to generate
bytecode and headers simultaneously.  Fortunately, the Gradle JNI
plugin at <https://github.com/wpilibsuite/gradle-jni> help us do this
cleanly.  Nice!
2018-06-04 12:29:57 -05:00
Ben Liblit 85651608e9 Don't use interpolated strings unless actually needed 2018-06-04 12:28:42 -05:00
Ben Liblit 6679262707 Refactor linker logic, and add "smoke_main" to automated tests
Previously we were compiling and linking "smoke_main", but not
actually running it as part of automated testing.  I simply overlooked
this in the process of recreating the Maven build logic in Gradle.
Now we run "smoke_main" when testing, which turns out to be a pretty
good test of our management of both Java search paths as well as
linker / shared library search paths.
2018-06-04 12:28:42 -05:00
Ben Liblit fbac524a02 Find JVM shared library better across versions and operating systems
We now use "-rpath" on both Linux and macOS.  This linker flag sets
the ELF RPATH on Linux, and the "@rpath" attribute on macOS, but
effectively it's doing the same thing, and that same thing is exactly
what we want.  I think.

On Linux, we also now look for the JVM shared library in three
different places.  The library has moved between Java 8 and 9, and
even on Java 9 it goes in a different place on Fedora 28 versus Ubuntu
16.04.
2018-06-04 12:28:42 -05:00
Ben Liblit 24151e7422 Don't specify Java version; defaults to whatever JVM is being used 2018-06-04 12:28:42 -05:00
Ben Liblit c7344e611a Remove TODO comment about producing native components for test only
According to
<https://docs.gradle.org/current/userguide/native_software.html>,
"When you assemble dependents of a component, the component and all of
its dependents are compiled and linked, including any test suite
binaries."  So it's intentional that the "assemble" task causes
creation of the smoke_main executable and xlator_test shared library.
Nothing TODO here; the current behavior is as designed.
2018-06-04 12:28:42 -05:00
Ben Liblit 2067d6c37a Open up some more vertical white space 2018-06-04 12:28:42 -05:00
Ben Liblit 989ef3ec43 Help Java 9 with some tricky generics type inference
The existing code worked fine under Java 8, but Java 9 fails to
resolve type constraints unless it has more explicit information about
at least one of the arguments to anyOf.  Weird.
2018-06-04 12:28:42 -05:00
Julian Dolby d2852beebf
Merge pull request #312 from liblit/gradle-load-plugins-modernization
Load Gradle plugins using “plugins” closure rather than “apply plugin”
2018-06-04 12:22:33 -04:00
Julian Dolby d1840f0531 make slicer handle multiple languages, using the Language to build mod and ref visitors 2018-06-01 13:56:08 -04:00
Julian Dolby 196f7cb153 fix for nasty bug in decoding dup2_x2 2018-05-31 19:32:02 -04:00
Julian Dolby 400b2055ce break basic blocks at eachelementget instructions 2018-05-30 12:26:19 -04:00
Ben Liblit e2ce6a84b0 Load plugins using "plugins" closure rather than "apply plugin"
Apparently the latter is considered a "legacy method":
<https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application>.
2018-05-23 16:47:58 -05:00
Julian Dolby 24d7757814
Merge pull request #309 from liblit/junit-4.12
Require JUnit 4.12 instead of 4.11
2018-05-21 21:46:05 -04:00
Julian Dolby 4a372eff2d
Merge pull request #308 from liblit/git-ignore-cleanups
Git ignore cleanups
2018-05-21 21:45:39 -04:00
Ben Liblit decd164fa6 Require JUnit 4.12 instead of 4.11
WALA itself does not use any JUnit 4.12 features.  However, I am
working on a WALA-based project that does require JUnit 4.12.  Mixing
jar versions is a path to madness.  So if the WALA maintainers don't
mind, it would make my life easier if WALA itself required JUnit 4.12.
Otherwise, I need to maintain that 4.11/4.12 difference indefinitely
as a divergence between official WALA and my WALA variant.

I suppose an alternative could be to let the JUnit version be
specified externally somehow. I have not explored this option in
depth, but could look into it if simply moving to JUnit 4.12 is
undesirable.
2018-05-21 17:27:54 -05:00
Ben Liblit b2e190ceed Remove a Java bytecode file that shouldn't be revision-tracked
We have the corresponding ".java" source file, so we can (and do)
rebuild this bytecode file whenever needed.
2018-05-21 16:15:53 -05:00
Ben Liblit 6fe9959a73 Ignore some more IntelliJ IDEA project metadata
I *think* that the per-module configuration metadata that goes here
should be per-developer, not tracked in git.
2018-05-21 16:14:48 -05:00
Ben Liblit 8146db20ff Remove git ignore patterns for several revision-tracked files
Someone may have thought that we were ignoring these files, but we
aren't.  From what I can tell, for these specific files, revision
tracking is intentional.
2018-05-21 16:14:48 -05:00
Julian Dolby 5236b95bd2 tighten type 2018-05-11 12:30:32 -04:00
Julian Dolby a3a6ce3f51 expose copy propagation records to allow better source position mapping even when copy propagation has occurred. 2018-05-09 18:10:20 -04:00
Julian Dolby 6b2db3e190 more-detailed source mapping information 2018-05-08 08:01:35 -04:00
Julian Dolby 8005b665b9 flexibility in how to model constants 2018-04-30 19:09:59 -04:00
Julian Dolby 2a7a98ed32 move code for sharing between javascript and python 2018-04-30 13:33:48 -04:00
Julian Dolby 27a8fff714 ast-based constant folding 2018-04-28 12:05:49 +02:00
Julian Dolby bc4939db97
Merge pull request #303 from liblit/tweaks-for-IntelliJ-IDEA
Tweaks for IntelliJ IDEA
2018-04-25 00:43:40 -04:00
Ben Liblit 45ea8969ed Add or ignore several metadata files created by IntelliJ IDEA
I decided which to keep and which to ignore by following advice given
at
<https://intellij-support.jetbrains.com/hc/en-us/articles/206544839>
and
<https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore>,
which in turn influenced <https://www.gitignore.io/api/jetbrains>.
2018-04-23 15:02:21 -05:00
Ben Liblit f7d07fe757 Ignore "out" subdirectories into which IntelliJ IDEA puts binaries 2018-04-23 14:53:49 -05:00
Ben Liblit e77535a41f Use the full Gradle wrapper distribution instead of just binaries
This follows an IntelliJ IDEA recommendation.  Having the full
distribution allows IntelliJ IDEA to provide contextual help,
autocompletion, etc. for Gradle build scripts.  The disadvantage, I
suppose, is that it imposes a larger download time on first use of
"gradlew".
2018-04-23 14:53:07 -05:00
Julian Dolby 49b0d66512
Merge pull request #300 from liblit/gradle-4.7
Upgrade Gradle wrapper to release 4.7
2018-04-19 08:06:45 -04:00
Ben Liblit 8e27f98f2d Upgrade Gradle wrapper to release 4.7
New features that I like from this release: (1) better output grouping
when building in parallel, and (2) automatic test ordering to try
previously-failing tests first.
2018-04-18 19:32:04 -05:00
Julian Dolby a6096e6d75
Merge pull request #299 from liblit/gradle-and-buildship
Build WALA using Gradle instead of Maven
2018-04-18 12:36:59 -04:00
Ben Liblit 209086f068 Bump version to 1.5.0-SNAPSHOT before merging with WALA master
This gives the WALA maintainers the option of doing future 1.4.5+
releases from of a pre-Gradle branch if these merged Gradle changes
turn out to be more disruptive than expected.
2018-04-18 11:29:29 -05:00
Ben Liblit 8529c10491 Use Gradle to create selected Eclipse metadata before Maven builds
The Eclipse metadata files created in this way are not identical to
those that Buildship would create when importing into Eclipse.  The
tests in com.ibm.wala.cast.java.test.JDTJava15IRTests and
com.ibm.wala.cast.java.test.JDTJavaIRTests seem to pass using either
the Gradle-generated or the Buildship-generated versions.

As an aside, if you generate these files using Gradle first and *then*
import using Buildship, you end up with metadata that is identical to
what you would have had if you'd only imported with
Buildship.  (There's one irrelevant difference in an unimportant
"<comment>" element.)  So Maven's tests should run fine under any
wacky mix of Gradle- and Buildship-generated Eclipse metadata files.

That being said, I recommend not mixing build systems.  WALA can be
built using either Maven, Gradle, or Eclipse+Buildship, but you're
probably better off only using one of these in any given build tree.
A mixed tree *should* probably work, but I haven't tested it
thoroughly, and consider better to avoid doing.

Incidentally, if there are other Maven-preparation steps that we'd
like Gradle to automate for us, that can now be done easily by
creating more "prepareMavenBuild" Gradle tasks in other subprojects
and adding the appropriate dependencies.  For example, it would be
trivial to use this to automate downloading "/tmp/DroidBench",
installing the Android SDK, etc.
2018-04-18 11:29:29 -05:00
Julian Dolby 61972810d0 more work on file names 2018-04-18 11:29:29 -05:00
Julian Dolby 380d0027d7 fixes for nodejs performance 2018-04-18 11:29:29 -05:00
Ben Liblit 00478ea806 Tell Travis CI to be even more patient during initial p2AsMaven downloads 2018-04-18 11:29:29 -05:00
Ben Liblit f28b63a025 Tell Travis CI to be more patient during initial p2AsMaven downloads 2018-04-18 11:29:29 -05:00
Ben Liblit 7cbccb33fb Simplify how we refer to the outputs of certain tasks 2018-04-18 11:29:29 -05:00
Ben Liblit 0e629f68e7 Exclude a test that has started failing due to running out of memory
I don't know what changes are triggering this.  Presumably it's
something to do with the temporary-file code, but I don't see why that
would happen.  For now, let's just skip this test.
2018-04-18 11:29:29 -05:00
Ben Liblit b14804bfdc Don't put fixed-name, writable files into "java.io.tmpdir"
If multiple tests both write to "/tmp/cg.txt" (for example), then
these tests cannot safely run concurrently.  That never used to be a
problem with Maven, since our Maven tests were all strictly sequential
anyway.  But parallelized testing using Gradle requires that we do
better.  Fortunately, Java has perfectly reasonable APIs for
generating uniquely-named temporary files and directories.
2018-04-18 11:29:29 -05:00
Ben Liblit ba01621de5 Don't use build cache (a.k.a. task output caching) under Travis CI
The performance improvement offered by the build cache is modest when
run by Travis CI.  This is probably because Travis CI does not keep
the cache on any local machine.  Instead, Travis CI uploads the build
cache across a network at the end of each run, then restores the cache
across the network at the start of the next run.  So in many cases
we're simply trading network access to original downloads for network
access to the cache image.

Furthermore, it's probably a better test to perform Travis CI testing
jobs from something closer to a clean slate.  We really want to know
whether everything builds and passes tests correctly starting from
nothing.  We don't want to risk accidentally thinking something would
work simply because we have a cached copy of what it did when it
worked previously.
2018-04-18 11:29:29 -05:00
Ben Liblit 47539da731 Unpack Android SDK and install extra components as a single task
Previously we unpacked in one task, then installed two extra
components in two dependent tasks.  However, installing extra
components modifies some files in place, effectively making those
files both inputs and outputs.  That creates race conditions, and
probably interferes with task output caching.  Better, then, to treat
the unpack and extra installations all as a single task whose output
is the complete Android SDK tree with all required components
installed.
2018-04-18 11:29:29 -05:00
Ben Liblit 01fc8fcae5 If tests fail, print full stack traces to aid debugging 2018-04-18 11:29:29 -05:00
Ben Liblit bd42510c6b Enable both parallel builds and build output caching by default
This should give us a nice build-performance boost, both locally and
in Travis CI.  I've used parallel builds routinely for months now, and
they're working fine.  Build output caching is newer, but it also
seems to be working well and saves us tremendous time on downloads.
2018-04-18 11:29:29 -05:00
Ben Liblit 3a1b1d1d1e Allow parallel testing within each subproject
Without this setting, Gradle would run multiple "test" tasks from
multiple subprojects concurrently, but each "test" task would only run
a single test at a time.  Some of our subprojects' test tasks take a
long time to complete, which could easily leave us sequentially
testing on just one or two CPU cores while other cores sit idle.

With this change, Gradle will use as many task slots as are
available (e.g., when run with "--parallel") to run multiple
simultaneous JUnit test classes within any given subproject.  This
seems to be fine for us:  I am unaware of any shared global state that
would cause conflicts between two test classes within any given
subproject.
2018-04-18 11:29:29 -05:00
Ben Liblit 4840966807 Don't try to exhaustively anticipate all generated header names
When JNI headers for a given class, each nested class will end up with
its own additional header.  But I don't want to try to parse nested
class details out of the Java source files just so we can determine
exactly which headers will be created.  Instead, simply treat the
entire header destination directory as the output of this task.
2018-04-18 11:29:29 -05:00
Ben Liblit 36fe02d71c Improve build caching by reducing path sensitivity where appropriate 2018-04-18 11:29:29 -05:00
Ben Liblit 74523f5058 Enable caching of task outputs for custom build tasks 2018-04-18 11:29:29 -05:00
Ben Liblit 000b21f36e Rename a build task to more clearly reflect what it builds
This task has an input named "hello_hash.ml", and an output named
"hello_hash.jar".  So calling this task "generateHelloHash" is too
vague.  Now we call it "generateHelloHashJar" instead.
2018-04-18 11:29:29 -05:00
Ben Liblit c0ec959e4a Extend Gradle's "clean" task to remove some additional build targets 2018-04-18 11:29:29 -05:00
Ben Liblit 328b1ec52b Merge info from existing, hand-authored manifests when building jars 2018-04-18 11:29:29 -05:00
Ben Liblit 4dc1e41529 Tell Eclipse to ignore some questionable manifest contents
These manifest files are here for use by the Maven build, but Eclipse
is now using Gradle (via Buildship).  So the manifests as seen by
Eclipse do not entirely make sense.  I'm hesitant to change the
manifests directly, since presumably they were correct for Maven and
still are.

Perhaps some day we'll be using Gradle to generate manifests.  Until
that day comes, we're better off leaving the manifests as they are and
just suppressing Eclipse's warnings instead.
2018-04-18 11:29:29 -05:00
Ben Liblit 7dcff25dcf After Builldship import, put "dx.jar" where the manifest expects it 2018-04-18 11:29:29 -05:00
Ben Liblit 72e5eb2b8d Restore old manifests in hope of fixing Maven regressions 2018-04-18 11:29:29 -05:00
Ben Liblit 7b96281e77 Bail out if any Travis CI testing commands fail
Previously we could fail some "mvn" stage but keep running anyway,
thereby fooling us into thinking that everything was OK.
2018-04-18 11:29:29 -05:00
Ben Liblit 3961b3a20e Incremental improvements to Windows JDK library configuration
This still doesn't actually work, but it's closer than it was before.
There's still some problem with improper mixing of 32-bit ("x86") and
64-bit ("x64") libraries.
2018-04-18 11:29:29 -05:00
Ben Liblit 298d6654d6 Clean up questionable memory management during string construction
Avoid allocating memory using strdup() and then releasing it using
operator delete.  strdup()-allocated memory should be released using
free(), not delete.  But in these specific cases, there really was
never any good reason to duplicate the C-style strings in the first
place.  Instead, we can safely pass those NUL-terminated char pointers
directly in calls to JNI's NewStringUTF().  NewStringUTF() does not
take ownership of its argument, but rather clones that string data
internally before returning.  So using strdup() and delete was just
unnecessary memory churn.

In cases where we need to format, concatenate, or construct new
strings, don't use sprintf() into variable-sized, stack-allocated
arrays.  Variable-sized arrays are not portable, and in particular are
rejected by Microsoft's Visual Studio 2017 C++ compiler.  Instead, do
our string formatting and manipulations using std::ostringstream
and/or std::string.  We just need to be a bit careful about the
lifetimes and ownership responsibilities of allocated data.  In
brief, (1) ostringstream::str() returns a temporary string instance
that expires at the end of the enclosing statement, independent of the
lifetime of the ostringstream instance; while (2) string::c_str()
returns an pointer to internal data that remains valid as long as the
string on which it was called is valid and unmodified.
2018-04-18 11:29:29 -05:00
Ben Liblit 216981f7e3 Somebody decided to use three-space indentation in this file only
OK, whatever makes you happy.
2018-04-18 11:29:29 -05:00
Ben Liblit 86fe6e9334 Fill in likely (but untested) JVM library path on Windows 2018-04-18 11:29:29 -05:00
Ben Liblit 5f2d64f85a Factor out common code for installing Android SDK components 2018-04-18 11:29:28 -05:00
Ben Liblit 587d0a95dc Skip DroidBench tests on Windows, for now
The default location of DroidBench in "/tmp/DroidBench" does not work
well on Windows. So let's disable these tests until someone has time to
make that path more portable.
2018-04-18 11:29:28 -05:00
Ben Liblit c642ec4039 Fix Android SDK installation under Windows 2018-04-18 11:29:28 -05:00
Ben Liblit 9295bcdd0d Switch to a different DroidBench download URL
This URL skips over a redirect that the previous URL went through.
This URL also avoids an annoying "Invalid cookie header" warning that
the previous URL produced.
2018-04-18 11:29:28 -05:00
Ben Liblit afd4bb49bb Use download task instead of "git clone" to get DroidBench
This gives us better progress reporting during the download, better
caching, better file-level dependency tracking, etc.
2018-04-18 11:29:28 -05:00
Ben Liblit 1d2a8a3e7e Factor out recurring pattern in download tasks 2018-04-18 11:29:28 -05:00
Ben Liblit 848530f39a Experimental combined task for download and checksum verification
Not working yet:
<https://github.com/michel-kraemer/gradle-download-task/issues/108>.
2018-04-18 11:29:28 -05:00
Ben Liblit 03e43d100b Update gradle-download-plugin and use some of its new features
We now download and verify checksums as a single task, rather than as
two separate tasks.  This simplifies other task dependencies, since we
no longer have a checksum-verified "stamp" file separate from the
download itself.  Unfortunately the combined task now has a
significant amount of repeated boilerplate.  I'm hoping to refactor
that all out into a custom task class, but haven't yet figured out the
details:
<https://github.com/michel-kraemer/gradle-download-task/issues/108>.

We now also use ETags to be smarter about when a fresh download is or
is not actually needed.  I think there are still opportunities for
improved caching here, but this is a step in the right direction.
2018-04-18 11:29:28 -05:00
Ben Liblit 9baf192416 If Travis CI gives us multiple CPUs, we may as well use them
I believe Travis CI jobs get two CPUs by default.

Doing parallel builds regularly is also a good way to help us discover
any build race conditions we may have.  There's no guarantee that any
such races will be revealed, but even exposing them
nondeterministically is better than having no possibility of exposing
them at all.
2018-04-18 11:29:28 -05:00
Ben Liblit 3cb91d1e67 Fix a shellcheck warning when setting a variable to the empty string 2018-04-18 11:29:28 -05:00
Ben Liblit 361b689966 Update to Gradle 4.6
No significant new features of interest for us in this release, but I
like to keep current.
2018-04-18 11:29:28 -05:00
Ben Liblit ea239ba484 Add a new README with Gradle-specific instructions and tips 2018-04-18 11:29:28 -05:00
Ben Liblit 49e5aa4f52 Remove two Maven repositories that we no longer use for anything
We used to use these to find various Eclipse packages, but that was
always a dodgy affair since we never quite knew whether we had
matching versions of everything.  Now that we are using the
"com.diffplug.gradle.p2.asmaven" plug-in, though, we have much better
control over getting exactly the Eclipse material we need.  These two
Maven repositories no longer provide anything we use, and therefore
can be removed.
2018-04-18 11:29:28 -05:00
Ben Liblit c0e6cd37b0 We only expect ".gradle" directories in two specific places 2018-04-18 11:29:28 -05:00
Ben Liblit 17fc048599 Generalize post-import Eclipse run configuration for more fixups
Previously this launcher's job was to run "processTestResources" and
any other Gradle tasks needed to create files that Eclipse was
expecting to be available.  But we also want to use it to revert the
bad changes that Buildship applies to ".launch" configuration files.

This is a temporary hack to work around
<https://github.com/eclipse/buildship/issues/653>.
2018-04-18 11:29:28 -05:00
Ben Liblit c6a6ef8b97 Minor indentation fix 2018-04-18 11:29:28 -05:00
Ben Liblit bcbd298808 Extra help for finding "cast" native library on macOS
Unlike Linux, macOS has no "RPATH" facility for embedding additional
search paths within shared libraries.  Instead, we need to set
"DYLD_LIBRARY_PATH" appropriately in the environment.  This
environment variable is the macOS analogue of "LD_LIBRARY_PATH" on
Linux.

Note that adding the required path to the "java.library.path" system
property will *not* work.  This property only affects where the JVM
looks for shared objects that it is loading directly.  This property
does not influence the search for other, transitively-required shared
objects.

Fixes #3.
2018-04-18 11:29:28 -05:00
Ben Liblit 48ffce525c Fix remaining Javadoc warnings
This fixes the last of our Javadoc warnings without creating a
circular dependency between ":com.ibm.wala.cast:javadoc" and
":com.ibm.wala.cast.js:javadoc".  Fixes #4, wherein more details about
this tricky dependency challenge can be found.
2018-04-18 11:29:28 -05:00
Ben Liblit 2a75244914 Use ".singleFile" instead of "[0]" when we expect just one file
This documents our intent more clearly, and actively checks for
mistakes rather than silently ignoring unexpected extra files.
2018-04-18 11:29:28 -05:00
Ben Liblit 1d8869bb0a Start exploring publication features by adding source jar archives 2018-04-18 11:29:28 -05:00
Ben Liblit 7fd8f02382 Replicate test include/exclude patterns already used in Maven builds 2018-04-18 11:29:28 -05:00
Ben Liblit 9a2af5bbb8 Add "com.ibm.wala.core.testdata" to classpath for testing
This lets the "DynamicCallGraphTest" tests pass.  The tests in that
class expect to find some element of the classpath that includes the
substring "com.ibm.wala.core.testdata".  They then treat that as a
collection of bytecode files to instrument.
2018-04-18 11:29:28 -05:00
Ben Liblit 4c179e51bc Skip a test intentionally; Maven already does the same
Big thanks to Julian for showing me where this exclusion logic lives
in the Maven configuration.  There's a "**/*AndroidLibs*.java"
exclusion pattern in the top-level "pom.xml".
2018-04-18 11:29:28 -05:00
Ben Liblit fca0f7c117 Fix jar exclusion patterns to match what Ant uses
One previously-failing test class now passes.  Progress!
2018-04-18 11:29:28 -05:00
Ben Liblit c2b1930248 Add some Eclipse dependencies needed only when running tests
This allows two test classes to pass that previously were failing.
Yay!
2018-04-18 11:29:28 -05:00
Ben Liblit bb98b2f84d Add a resource directory containing a zip archive used for testing
The excluded test in this subproject still does not pass, though now
it's failing for a different reason than before.  Progress, I suppose!
2018-04-18 11:29:28 -05:00
Ben Liblit 20be2b59c4 Disable Gradle linter check for unused dependencies in Travis CI
It's telling me to remove "eclipse-deps:org.eclipse.core.runtime:+"
and "org.osgi:org.osgi.core:4.2.0" as unused dependencies in the
"com.ibm.wala.cast.java.ecj" subproject.  However, these two
dependencies (jar files) are actually needed; compilation fails
without them.
2018-04-18 11:29:28 -05:00
Ben Liblit d0bf53474b Also get Eclipse JSDT from a P2 repository, but not the same one 2018-04-18 11:29:28 -05:00
Ben Liblit c16f172932 Find Eclipse jars using local Maven mirror of Eclipse P2 repository
This should give us a set of mutually-consistent jars rather than
picking up random, outdated pieces from Maven Central or wherever else
I could find them.  We now also have a single, central place where we
set the Eclipse version that we're building against.  Much, *much*
cleaner.
2018-04-18 11:29:28 -05:00
Ben Liblit fc0b951ead Assume that Eclipse needs all standard test-resource processing 2018-04-18 11:29:28 -05:00
Ben Liblit a99db6b946 Trivial whitespace tweak 2018-04-18 11:29:28 -05:00
Ben Liblit 01e54886df Exclude one macOS test that I don't know how to fix right now 2018-04-18 11:29:28 -05:00
Ben Liblit 3d026d409e Download appropriate Android SDK for current OS 2018-04-18 11:29:28 -05:00
Ben Liblit baee9d32e1 Try to continue building/testing even after the first failure
If other, non-dependent tasks would also fail, I'd rather discover all
of them at once.
2018-04-18 11:29:28 -05:00
Ben Liblit d8948324f7 "rm" on macOS apparently doesn't understand long ("--foo") flags 2018-04-18 11:29:28 -05:00
Ben Liblit 393ef13622 macOS doesn't seem to have "xvfb-run", and may not need it anyway 2018-04-18 11:29:28 -05:00
Ben Liblit b5cfd56041 Enable macOS (a.k.a. OS X) Travis CI testing for Gradle builds
We're not going to attempt macOS Travis CI testing for Maven builds,
because I don't know whether that's even expected to work on the
official WALA master branch.  Our main focus here is Gradle.

Note that Travis macOS images do not support JDK switching, so
explicitly selecting the JDK version now becomes part of the
Linux-only configuration.

Travis macOS images also do not support Android as a build "language".
So our Travis CI configuration for Gradle builds now declares that
this is a Java project rather than an Android one.  That's OK, though,
because our Gradle scripts already handle downloading the Android SDK;
we don't need Travis CI to do that for us.  When building using Maven,
though, we still call this an Android project because Maven builds do
still rely on Travis CI to provide the Android SDK.

squash! Enable macOS (a.k.a. OS X) Travis CI testing for Gradle builds
2018-04-18 11:29:27 -05:00
Ben Liblit 4853d2b275 Download a specific DroidBench release that we know works for us
If future DroidBench changes include things we need, then we can
decide to move to those newer revisions.  But we shouldn't allow
DroidBench to change out from under us implicitly whenever someone
commits something new to the DroidBench repository.
2018-04-18 11:29:27 -05:00
Ben Liblit c223625f22 Add "TODO" reminders of furture refactoring opportunities 2018-04-18 11:29:27 -05:00
Ben Liblit af5a22d4bb Factor out some repeated accesses to a task's output files 2018-04-18 11:29:27 -05:00
Ben Liblit 1cf1d7c05a Derive Android platforms version from Android build-tools version
This should help us keep the two in sync if the latter changes one
day.
2018-04-18 11:29:27 -05:00
Ben Liblit dfe3659dcb Got DynamicDalvikComparisonJavaLibsTest working at some point 2018-04-18 11:29:27 -05:00
Ben Liblit bbc9ec7e97 Ignore a transient file that appears during testing 2018-04-18 11:29:27 -05:00
Ben Liblit eb00a84a40 Grab an additional archive needed by DalvikAnnotationsTest 2018-04-18 11:29:27 -05:00
Ben Liblit 22245f8cb4 Download a few additional supporting files needed by tests 2018-04-18 11:29:27 -05:00
Ben Liblit 79c8cf1411 Import a class that we will soon be using multiple times 2018-04-18 11:29:27 -05:00
Ben Liblit 2e04ac9838 Fix accidental copying of entire subproject as test resource 2018-04-18 11:29:27 -05:00
Ben Liblit 90a947dad1 Use an "android.jar" that matches the "dx.jar" we are already using
Nothing was obviously failing with the older "android.jar", but I feel
more comfortable knowing that these two are more closely matched.
2018-04-18 11:29:27 -05:00
Ben Liblit fde718b5d3 Suppress harmless broken-pipe warnings from "yes" 2018-04-18 11:29:27 -05:00
Ben Liblit 386cdc117b Set Android build-tools version in just one place 2018-04-18 11:29:27 -05:00
Ben Liblit bc0062e4b0 Use more recent "dx.jar" than is available through Maven Central
This lets us ditch pre-Java-8 in the Gradle build.  (The official WALA
master branch recently got rid of pre-Java-8 in its Maven build.)
That, in turn, lets two "com.ibm.wala.dalvik.test" tests pass that
previously were failing.  We still have two other failing tests in
that subproject, but this is definitely progress!

Our Gradle build scripts manage the entire process of downloading and
locally installing the appropriate Android SDK.  That includes
automatically accepting a license.  Maybe some lawyer will throw a fit
about that some day.  Until then, I'd rather have a build system that
does everything needed without imposing additional manual steps on
developers.
2018-04-18 11:29:27 -05:00
Ben Liblit a09be64332 Ignore some transient files that appear during testing 2018-04-18 11:29:27 -05:00
Ben Liblit 77e0fc2b9c Set name and version to help Gradle composite-build substitutions 2018-04-18 11:29:27 -05:00
Ben Liblit 5398570308 Update Eclipse JUnit test launchers for use with Buildship
Previously Buildship removed its classpath from all of these
launchers.  Now it's automatically putting that back in as soon as I
visit each launcher in Eclipse's "Run Configurations" dialog.  Not
sure what's going on here, but it certainly seems more sane to me to
assume that the Buildship-computed classpath *is* needed for all of
these.  I have an open question on the Gradle discussion forum to try
to understand what's going on here and how to fix it:
<https://discuss.gradle.org/t/launchers-lose-buildship-classpath-on-import-regain-it-later/25641>.
2018-04-18 11:29:27 -05:00
Ben Liblit 525c4aa5fe Update Eclipse "Java Application" launchers for use with Buildship 2018-04-18 11:29:27 -05:00
Ben Liblit c2edaf3119 Use Eclipse-computed paths rather than hard-coding absolute paths 2018-04-18 11:29:27 -05:00
Ben Liblit ca17b12187 Remove launchers whose main Java code is found nowhere in WALA 2018-04-18 11:29:27 -05:00
Ben Liblit f6db318c91 Note some excessive resource copying that we should eventually fix 2018-04-18 11:29:27 -05:00
Ben Liblit 39781604a2 Create a broad "Process Test Resources" Eclipse launch configuration
This should prepare test resources for all subprojects.  A WALA
developer should run this once before running any tests inside
Eclipse.  Initially I'd hoped to make this more narrowly focused, but
Eclipse just doesn't have the infrastructure to deal with fine-grained
dependencies.  On the other hand, running "./gradlew
eclipsePrepareTestResources" automatically for each build seems like
overkill, and could end up being rather slow.  So for now we require
that the developer run this once, by hand.
2018-04-18 11:29:27 -05:00
Ben Liblit 61d8ee1b02 Fix various warnings produced by "./gradlew javadoc"
Three stubborn warnings remain, but this is progress!
2018-04-18 11:29:27 -05:00
Ben Liblit eb4e97a665 Fix warnings about Javadoc links to "java.lang.reflect" package 2018-04-18 11:29:27 -05:00
Ben Liblit da90d1cf5a Trigger custom clean tasks whenever running "./gradlew clean"
A cleaned tree is now much closer to a pristine tree that has just
been checked out and never built.  The only extra created files that
are left behind are ".gradle", "buildSrc/.gradle", and
"buildSrc/build".
2018-04-18 11:29:27 -05:00
Ben Liblit 51cef18bc9 Unpack node.js in the same place that Maven unpacks it
This gets rid of some Eclipse warnings that stem from Buildship being
confused about what it should treat as a source directory if Maven and
Gradle are both being used in the same tree.
2018-04-18 11:29:27 -05:00
Ben Liblit b3dab4c2b0 Tweak Buildship-generated Eclipse ".project" file for extra jars 2018-04-18 11:29:27 -05:00
Ben Liblit 504849e6f5 Update Gradle wrapper to Gradle 4.5
No major new features for us here, but better native caching and other
performance improvements.
2018-04-18 11:29:27 -05:00
Ben Liblit 5f2bab0f3d Get a core test to work by putting "bcel-5.2.jar" where expected 2018-04-18 11:29:27 -05:00
Ben Liblit 031740338f Get a Dalvik test to work by putting "dx.jar" where expected 2018-04-18 11:29:27 -05:00
Ben Liblit 817166c128 Compute a library path from the native software model
Previously we were repeating the library path twice, but that's not
good for long-term maintenance.  That being said, extracting this
information from the depths of the native software model seems *far*
more complex than it should be.  I had hoped for something nicer in
response to
<https://discuss.gradle.org/t/compute-wl-rpath-flag-suitable-for-native-shared-library/25278>,
but so far there's nothing.
2018-04-18 11:29:27 -05:00
Ben Liblit 50bed1cbe8 Compute a library path from the corresponding linker task
Previously we were repeating the library path twice, but that's not
good for long-term maintenance.
2018-04-18 11:29:27 -05:00
Ben Liblit 22421c6882 rpath only matters for shared libraries 2018-04-18 11:29:27 -05:00
Ben Liblit 7c4c2c895c Add previously-undeclared dependency of tests on native library 2018-04-18 11:29:27 -05:00
Ben Liblit a98b913373 Avoid random leftover junk by using "Sync" instead of "Copy" 2018-04-18 11:29:27 -05:00
Ben Liblit c98ea16374 Simplify filtering of archive contents 2018-04-18 11:29:26 -05:00
Ben Liblit 8303eaba4c Override specific "cleanFooBar" tasks instead of generic "clean" 2018-04-18 11:29:26 -05:00
Ben Liblit 5b825997bf Be more concise by calling property setters instead of assigning 2018-04-18 11:29:26 -05:00
Ben Liblit ad1f024b77 Be more concise by omitting implicit "it." in closures 2018-04-18 11:29:26 -05:00
Ben Liblit 2aadd55227 Change archive file names while unpacking, rather than in two stages 2018-04-18 11:29:26 -05:00
Ben Liblit c812e72cb5 Use Groovy's implicit "it" closure argument 2018-04-18 11:29:26 -05:00
Ben Liblit 17b1d85f76 Remove leftover debugging output that I no longer need 2018-04-18 11:29:26 -05:00
Ben Liblit 2e54ec4b0c Download "android-4.1.1.4.jar" (as "android.jar") when needed
Previously Maven did this, but Gradle did not.  So Gradle testing
would only succeed if we'd already done a Maven build first.  Now
these tests pass in a fresh tree that's never seen a Maven build.
2018-04-18 11:29:26 -05:00
Ben Liblit d745f4509f Simplify how we refer to a task's only output 2018-04-18 11:29:26 -05:00
Ben Liblit 07dd646a40 Don't bother importing when we only need one symbol, one time 2018-04-18 11:29:26 -05:00
Ben Liblit f1b2080f99 Download NodeJS and include its "lib/*.js" files in jar archive 2018-04-18 11:29:26 -05:00
Ben Liblit 70fd9a3091 Remove "extraBundledJars" task, which nothing else actually uses
Some tests in other subprojects do depend on some these extra jar
files.  But they can declare those specific dependencies as needed.
Nothing seems to depend on the entire group of extra jars, so it's not
really useful to declare a task that is merely an alias for all of
them.
2018-04-18 11:29:26 -05:00
Ben Liblit 1346a8ac55 Set working directory in the same way Maven does
This seems to help ECJSyncDuplicatorTest find a "./src/Monitor2.java"
file that it needs.  The test still fails, though, for other reasons.
2018-04-18 11:29:26 -05:00
Ben Liblit da30f5dbb4 Enable a few more tests that started working, or perhaps always did 2018-04-18 11:29:26 -05:00
Ben Liblit 20cba8a8d8 Factor out recurring pattern of MD5 checksum + stamp file 2018-04-18 11:29:26 -05:00
Ben Liblit b7b01c8486 Replicate Maven's extra system property settings for some tests 2018-04-18 11:29:26 -05:00
Ben Liblit a1cf040897 Add missing test resources to make many more regression tests pass 2018-04-18 11:29:26 -05:00
Ben Liblit afeba0d984 Remove some test exclusions that are not actually needed now 2018-04-18 11:29:26 -05:00
Ben Liblit 51f748bddc Replicate Maven's heap size limits for tests 2018-04-18 11:29:26 -05:00
Ben Liblit 1bfdf978f2 Buildship removed classpath provider thing from more launch configs
This is more of the same sort of change first seen in a1bd95d.  Still
no idea why it happens; still hoping that Buildship knows what it's
doing.
2018-04-18 11:29:26 -05:00
Ben Liblit 5040019cec Turn on proper regression testing in Travis-CI
Many tests are excluded until
<https://github.com/liblit/WALA/issues/5> is fixed.  But we can at
least have Travis-CI watching over our shoulder to ensure that
no *new* regressions sneak into the tree.
2018-04-18 11:29:26 -05:00
Ben Liblit 5c30dd7581 Explicitly disable regression tests that are currently failing
<https://github.com/liblit/WALA/issues/5> notes that several
subprojects' tests are currently broken under Gradle.  I'd still like
to be able to run non-broken tests, though.  So here I'm disabling the
failing tests.  The intent is to treat these exclusions as a to-do
list.  We can remove exclusions as we get the corresponding tests
working.  No more exclusions means
<https://github.com/liblit/WALA/issues/5> is fixed.
2018-04-18 11:29:26 -05:00
Ben Liblit 91ca24584b Explicitly make "/tmp/DroidBench" be a file, not just a string
I'm hoping this might remove some seemingly-spurious reruns of this
task.  Still not sure why those are happening, though.
2018-04-18 11:29:26 -05:00
Ben Liblit e6677c5aed Do not run Gradle linter by default
It's rather slow, adding roughly five seconds to every "./gradlew"
invocation.  And the advice it gives might not even be reaching a
fixed point.  I like the idea of running the linter as part of CI
testing, but I now think it's overkill to impose on every developer
build.
2018-04-18 11:29:26 -05:00
Ben Liblit d720046110 Dependency tweaks suggested by Gradle linter
I'm starting to wonder whether the linter might be driving us in
cycles rather than reaching a fixed point.  We should keep our eyes on
this.
2018-04-18 11:29:26 -05:00
Ben Liblit 3ba04469ad Teach Gradle how to download "/tmp/DroidBench" when needed
One less thing for developers to have to remember to do manually!
2018-04-18 11:29:26 -05:00
Ben Liblit e9eb934b82 Give each verification task an output for better incremental building 2018-04-18 11:29:26 -05:00
Ben Liblit 98324cd148 Simplify how we refer to existing tasks 2018-04-18 11:29:26 -05:00
Ben Liblit ed275f12a9 Add missing resources for "com.ibm.wala.cast.js.test" tests
The ":com.ibm.wala.cast.js.test:build" task now passes.
2018-04-18 11:29:26 -05:00
Ben Liblit 01acd0e338 RPath settings apply only to Linux; some only to Linux on x86_64
I don't know whether Windows or MacOS needs anything similar.  If they
do, the details will differ, and should be handled by adding suitable
cases to these switch statements.
2018-04-18 11:29:26 -05:00
Ben Liblit 564a4eb9bd Correctly declare dependency on a task that has not been defined yet 2018-04-18 11:29:26 -05:00
Ben Liblit 054a106ae5 Dependency tweaks suggested by Gradle linter
This partially reverts 72bc456b7.  I'm starting to wonder whether the
linter might be driving us in cycles rather than reaching a fixed
point.  We should keep our eyes on this.
2018-04-18 11:29:26 -05:00
Ben Liblit 16ec6d7461 Simplify file management for a download task 2018-04-18 11:29:26 -05:00
Ben Liblit 0bb899b503 Download, extract, and/or construct various additional bundled jars
I don't really know what these are all used for.  However, Maven+Ant
builds them, so for now Gradle should too.
2018-04-18 11:29:26 -05:00
Ben Liblit 1e1de1bdb9 Prefer single-quoted (non-interpolated) strings where sufficient 2018-04-18 11:29:26 -05:00
Ben Liblit 35663c1264 Teach Gradle how to find and copy a Jar archive that we bundle
I'm not actually sure why this archive is needed, except that it is
mentioned in "META-INF/MANIFEST.MF" and "build.properties".  If we
eventually stop supporting Maven, then we may be able to discard the
"copyJarsIntoLib" task and the corresponding lines in
"META-INF/MANIFEST.MF" and "build.properties"
2018-04-18 11:29:25 -05:00
Ben Liblit dd1f51e8f0 Buildship removed classpath provider thing from all launch configs
This consistently happens when I import WALA as an existing Gradle
project into Eclipse with Buildship.  I don't really know what this
change means, or whether it's desirable.  For now, I'm going to trust
Buildship and see what happens.
2018-04-18 11:29:25 -05:00
Ben Liblit 1ebabf8b60 Complain more loudly about missing output directories 2018-04-18 11:29:25 -05:00
Ben Liblit 3380b78f38 This is no longer how we'll build the native library in Eclipse 2018-04-18 11:29:25 -05:00
Ben Liblit ba5849afb6 Simplify inclusion of "OSGI-INF" and the only file it contains 2018-04-18 11:29:25 -05:00
Ben Liblit 6bcca003a2 Tweak output dirs to match what Buildship puts into ".classpath" 2018-04-18 11:29:25 -05:00
Ben Liblit 9a3ecd6ab9 Disable some Eclipse warnings on Java test inputs
I think these were previously not being compiled at all.  Now, with
Buildship generating Eclipse ".project" settings automatically, these
are being processed.  In general we don't care much about questionable
code in test data, though.
2018-04-18 11:29:25 -05:00
Ben Liblit 89860b53bb Let Buildship create new settings files when importing
These settings files currently are generated with an initial timestamp
comment line, which is not something we'd want to track in version
control.  Fortunately, the contents of these files are entirely
mundane, so there should be no problem with having Buildship generate
them anew each time a developer imports WALA into Eclipse as an
existing Gradle project.
2018-04-18 11:29:25 -05:00
Ben Liblit 4b48f8ee4d Have Buildship add Eclipse plugin (PDE) nature to some subprojects
Specifically, we need this for subprojects that build included plugins
for any of the "*_feature" subprojects.
2018-04-18 11:29:25 -05:00
Ben Liblit 310ef1daa5 Exclude Eclipse ".project" and ".classpath" from version control
Apparently Buildship generates these when one uses Import -> Existing
Gradle Project:
<https://discuss.gradle.org/t/buildship-eclipse-plug-in-multiproject-builds/24030/5>.
We can use the Gradle "eclipse" plugin if customizations are
necessary, but my impression is that the intent is to treat ".project"
and ".classpath" as generated files, not sources to be tracked in
source control.
2018-04-18 11:29:25 -05:00
Ben Liblit 8d0f64f3c6 Update Gradle wrapper to latest version (4.4.1) 2018-04-18 11:29:25 -05:00
Sungho Lee 3984cd0001 Fill the dynamic library path for OSX 2018-04-18 11:29:25 -05:00
Sungho Lee c1f6b70eb0 Fill the dynamic library path for OSX 2018-04-18 11:29:25 -05:00
Ben Liblit 3ce242a22c Simplify loading of plugins shared by many subprojects 2018-04-18 11:29:25 -05:00
Ben Liblit 1432e18c37 Clean up some simple syntactic redundancy in dependency declarations 2018-04-18 11:29:25 -05:00
Sungho Lee 9084cb9ad3 Check Java version 2018-04-18 11:29:25 -05:00
Sungho Lee 6bc547a48b Remove unused dependencies 2018-04-18 11:29:25 -05:00
Ben Liblit 69a67fe7ec Better handling of OS- and architecture-specific JDK paths 2018-04-18 11:29:25 -05:00
Ben Liblit 0500d237f9 Add various test resource directories
Unfortunately these tests are still not finding their resources
properly at test run time.  I don't know why.  It seems to have
something to do with how the tests instantiate and use class loaders.
I'm probably going to need expert help with this.
2018-04-18 11:29:25 -05:00
Ben Liblit 7fc607cc1c Dependency tweaks suggested by Gradle linter 2018-04-18 11:29:25 -05:00
Ben Liblit 3d973e9d61 Find the "xlator_test" shared library at test run time
Dependencies are still not set properly here, so you need to have
built the shared library ("./gradlew xlator_testSharedLibrary") before
running the ":com.ibm.wala.cast.test:test" test task.  But at least
the tests do now find and load that shared library properly.
2018-04-18 11:29:25 -05:00
Ben Liblit 5d5fa18b5f Replace source directories rather than appending to them
I was confused about the differences among:

	srcDir 'foo'
	srcDirs ['foo']
	srcDirs = ['foo']

As it turns out, the first two append to the set of source
directories, while the last replaces this set entirely.  I generally
want replacement, since WALA's current directory layout never matches
Gradle's assumed defaults.
2018-04-18 11:29:25 -05:00
Ben Liblit 0704a66ab1 Cleaner way to form colon-deliminated search path from list of paths 2018-04-18 11:29:25 -05:00
Ben Liblit 0f69db6fe3 Cleaner approach to augmenting Javadoc classpath 2018-04-18 11:29:25 -05:00
Ben Liblit 01a4fe025e Start getting some unit tests to pass
The main requirement here is to arrange for the proper classpath
settings when tests are running so that they can find any associated
resources (i.e., other supporting files).
2018-04-18 11:29:25 -05:00
Ben Liblit 04d9397a1d Tweak classpath for some Javadoc build tasks
This comes up when the Javadoc comments refer to classes in other
subprojects that the corresponding Java code did not actually depend
upon.
2018-04-18 11:29:25 -05:00
Ben Liblit e52c8d981d Declare common library dependencies for source sets, not binaries
No sense repeating this for each binary when it's the same for all of
them.
2018-04-18 11:29:25 -05:00
Ben Liblit b9e712bfa9 Add a second native library and a native executable 2018-04-18 11:29:25 -05:00
Ben Liblit 43a482dfae Add Gradle logic for building a native library
This approach uses no external makefiles; it's pure Gradle.  Nice!
2018-04-18 11:29:25 -05:00
Ben Liblit 6007b11c3f Compile test code, but don't run it for now
The tests are currently broken due to some sort of problem using class
loaders to find supporting resources.  Until I figure this out, better
to have Travis-CI verify only the things we think work.
2018-04-18 11:29:25 -05:00
Ben Liblit 377d7586ef Consistently use simple sorted order for dependencies
This isn't even sorting by library or subproject name.  It's just a
dumb textual sort of the contents of each line.
2018-04-18 11:29:25 -05:00
Ben Liblit db2d34b60d Leave Gradle linter turned on by default, now that it's quieter 2018-04-18 11:29:25 -05:00
Ben Liblit afa982adf2 Properly distinguish main from test code, now that I know how 2018-04-18 11:29:25 -05:00
Ben Liblit a56a3616dc Selectively disable some Gradle linter rules
Specifically, we're not really in a position now to deal with
duplicated classes among our dependencies.  Maybe we can try harder to
examine those in the future, but for now they are a distraction from
other issues that we can attack more readily.
2018-04-18 11:29:25 -05:00
Ben Liblit 9cd5d2ba56 Split generic Java setup from OSGi substitution setup 2018-04-18 11:29:25 -05:00
Ben Liblit 1ca17e93be Automated Gradle-driven download of JLex test input 2018-04-18 11:29:25 -05:00
Ben Liblit 9664b1e5b3 Disable Javadoc linter for now
Some of the linter's checks produce failures (errors) when Gradle
builds the Javadoc documentation.  Fixing them isn't really a Gradle
issue, though, so I don't want to deal with them now.
2018-04-18 11:29:24 -05:00
Ben Liblit 18495ab44d Improve documentation for broad sections of top-level build script 2018-04-18 11:29:24 -05:00
Ben Liblit 9e905c7a04 More Gradle dependency clean-ups suggested by linter
Unfortunately the linter does not reach a fixpoint if you keep trying
to apply its suggestions.  If you include "compile
'org.eclipse.core:org.eclipse.core.runtime:3.10.0.v20140318-2214'" in
the dependencies for "com.ibm.wala.ide.jdt", then the linter tells you
that this dependency is unused and can be removed.  If you remove it,
then the linter tells you that it should be added.  Sigh.
2018-04-18 11:29:24 -05:00
Ben Liblit b3dbdd3357 Fix a tricky cross-subproject Javadoc dependency
By default, each subproject's Javadoc task depends on the same
subproject's Java compilation task, and uses the same classpath.
Thus, any classes that some Java code uses will also be visible when
building the same Java code's documentation.

In this case, we need to see one of the "com.ibm.wala.core" classes in
order to build the "com.ibm.wala.util" documentation.  However, we
cannot have Java compilation of "com.ibm.wala.util" depend on Java
compilation of "com.ibm.wala.core", because that would create a
dependency cycle.  So we need to add this as a special dependency just
for the "com.ibm.wala.util" documentation task, and add the
appropriate classpath as well.

I'm quite proud of myself for figuring out how to do this properly.
2018-04-18 11:29:24 -05:00
Ben Liblit ad60605fe8 In Travis-CI, test Maven and Gradle separately and concurrently
This should help identify cases where the Gradle build only works if
it runs before or after a Maven build.  It will also help us recognize
any Maven regressions accidentally introduced by our Gradle work.
2018-04-18 11:29:24 -05:00
Ben Liblit dec3b8f15b Add a Gradle linter to help me write clean build configurations
The linter does not run by default.  To activate it, use "./gradlew
autoLintGradle".
2018-04-18 11:29:24 -05:00
Ben Liblit 2ef04905c2 Additional explicit dependencies suggested by Gradle linter 2018-04-18 11:29:24 -05:00
Ben Liblit eac47334ca Automated Gradle-driven download of AJAXSLT test inputs
I'm not sure that I am doing this in the best way possible.  But it
seems to be working.  Refinements are welcome!
2018-04-18 11:29:24 -05:00
Ben Liblit 2716731357 Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit 209c1d25c6 Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit cd304237ea Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit 8e5415e3db Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit 25a52254f5 Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit f41baeb0f8 Add a direct dependency that previously we picked up transitively 2018-04-18 11:29:24 -05:00
Ben Liblit cebf14c8c5 Run a Gradle build after the Maven build
Eventually I'll want to swap that order, so that we know that Gradle
builds work even without any help from Maven build setup logic.  For
now, though, I just want to test whether the Gradle build works at
all.
2018-04-18 11:29:24 -05:00
Ben Liblit 530d74929f Many improvements to Gradle build support, including within Eclipse 2018-04-18 11:29:24 -05:00
Sungho Lee ffaa2e4626 change hamcrest library version of core.tests 2018-04-18 11:29:24 -05:00
Sungho Lee b4fa7f425b Support the gradlew build 2018-04-18 11:29:24 -05:00
Sungho Lee 50d0f7ee71 Change build.gradle files for proper format and delete all tests 2018-04-18 11:29:24 -05:00
Sungho Lee 4a31927b00 Gradle build scripts 2018-04-18 11:29:24 -05:00
Ben Liblit 99c2493e37 Revert "Build WALA using Gradle instead of Maven" (#298) 2018-04-18 12:15:56 -04:00
Julian Dolby 8f41069b23
Merge pull request #278 from liblit/gradle-and-buildship
Build WALA using Gradle instead of Maven
2018-04-18 08:22:25 -04:00
Ben Liblit 6639d8b93a Bump version to 1.5.0-SNAPSHOT before merging with WALA master
This gives the WALA maintainers the option of doing future 1.4.5+
releases from of a pre-Gradle branch if these merged Gradle changes
turn out to be more disruptive than expected.
2018-04-17 15:32:01 -05:00
Ben Liblit 742cad58e9 Use Gradle to create selected Eclipse metadata before Maven builds
The Eclipse metadata files created in this way are not identical to
those that Buildship would create when importing into Eclipse.  The
tests in com.ibm.wala.cast.java.test.JDTJava15IRTests and
com.ibm.wala.cast.java.test.JDTJavaIRTests seem to pass using either
the Gradle-generated or the Buildship-generated versions.

As an aside, if you generate these files using Gradle first and *then*
import using Buildship, you end up with metadata that is identical to
what you would have had if you'd only imported with
Buildship.  (There's one irrelevant difference in an unimportant
"<comment>" element.)  So Maven's tests should run fine under any
wacky mix of Gradle- and Buildship-generated Eclipse metadata files.

That being said, I recommend not mixing build systems.  WALA can be
built using either Maven, Gradle, or Eclipse+Buildship, but you're
probably better off only using one of these in any given build tree.
A mixed tree *should* probably work, but I haven't tested it
thoroughly, and consider better to avoid doing.

Incidentally, if there are other Maven-preparation steps that we'd
like Gradle to automate for us, that can now be done easily by
creating more "prepareMavenBuild" Gradle tasks in other subprojects
and adding the appropriate dependencies.  For example, it would be
trivial to use this to automate downloading "/tmp/DroidBench",
installing the Android SDK, etc.
2018-04-17 15:02:36 -05:00
Julian Dolby 89ffb96acf more work on file names 2018-04-17 15:02:36 -05:00
Julian Dolby 1ba0082896 fixes for nodejs performance 2018-04-17 15:02:36 -05:00
Ben Liblit 563d7446d1 Tell Travis CI to be even more patient during initial p2AsMaven downloads 2018-04-17 15:02:36 -05:00
Ben Liblit 0290469ba7 Tell Travis CI to be more patient during initial p2AsMaven downloads 2018-04-17 15:02:36 -05:00
Ben Liblit 5df33f85d7 Simplify how we refer to the outputs of certain tasks 2018-04-17 15:02:36 -05:00
Ben Liblit 929fdb99af Exclude a test that has started failing due to running out of memory
I don't know what changes are triggering this.  Presumably it's
something to do with the temporary-file code, but I don't see why that
would happen.  For now, let's just skip this test.
2018-04-17 15:02:36 -05:00
Ben Liblit 7886fa13dc Don't put fixed-name, writable files into "java.io.tmpdir"
If multiple tests both write to "/tmp/cg.txt" (for example), then
these tests cannot safely run concurrently.  That never used to be a
problem with Maven, since our Maven tests were all strictly sequential
anyway.  But parallelized testing using Gradle requires that we do
better.  Fortunately, Java has perfectly reasonable APIs for
generating uniquely-named temporary files and directories.
2018-04-17 15:02:36 -05:00
Ben Liblit 6599d3d294 Don't use build cache (a.k.a. task output caching) under Travis CI
The performance improvement offered by the build cache is modest when
run by Travis CI.  This is probably because Travis CI does not keep
the cache on any local machine.  Instead, Travis CI uploads the build
cache across a network at the end of each run, then restores the cache
across the network at the start of the next run.  So in many cases
we're simply trading network access to original downloads for network
access to the cache image.

Furthermore, it's probably a better test to perform Travis CI testing
jobs from something closer to a clean slate.  We really want to know
whether everything builds and passes tests correctly starting from
nothing.  We don't want to risk accidentally thinking something would
work simply because we have a cached copy of what it did when it
worked previously.
2018-04-17 15:02:36 -05:00
Ben Liblit 93c8d126b8 Unpack Android SDK and install extra components as a single task
Previously we unpacked in one task, then installed two extra
components in two dependent tasks.  However, installing extra
components modifies some files in place, effectively making those
files both inputs and outputs.  That creates race conditions, and
probably interferes with task output caching.  Better, then, to treat
the unpack and extra installations all as a single task whose output
is the complete Android SDK tree with all required components
installed.
2018-04-17 15:02:36 -05:00
Ben Liblit b13e5d72b1 If tests fail, print full stack traces to aid debugging 2018-04-17 15:02:36 -05:00
Ben Liblit 9cbfff23f5 Enable both parallel builds and build output caching by default
This should give us a nice build-performance boost, both locally and
in Travis CI.  I've used parallel builds routinely for months now, and
they're working fine.  Build output caching is newer, but it also
seems to be working well and saves us tremendous time on downloads.
2018-04-17 15:02:36 -05:00
Ben Liblit c034dce3c3 Allow parallel testing within each subproject
Without this setting, Gradle would run multiple "test" tasks from
multiple subprojects concurrently, but each "test" task would only run
a single test at a time.  Some of our subprojects' test tasks take a
long time to complete, which could easily leave us sequentially
testing on just one or two CPU cores while other cores sit idle.

With this change, Gradle will use as many task slots as are
available (e.g., when run with "--parallel") to run multiple
simultaneous JUnit test classes within any given subproject.  This
seems to be fine for us:  I am unaware of any shared global state that
would cause conflicts between two test classes within any given
subproject.
2018-04-17 15:02:36 -05:00
Ben Liblit 3f5460231e Don't try to exhaustively anticipate all generated header names
When JNI headers for a given class, each nested class will end up with
its own additional header.  But I don't want to try to parse nested
class details out of the Java source files just so we can determine
exactly which headers will be created.  Instead, simply treat the
entire header destination directory as the output of this task.
2018-04-17 15:02:36 -05:00
Ben Liblit 66a4d20e3a Improve build caching by reducing path sensitivity where appropriate 2018-04-17 15:02:36 -05:00
Ben Liblit 6869a4d5f4 Enable caching of task outputs for custom build tasks 2018-04-17 15:02:36 -05:00
Ben Liblit e42e36c4de Rename a build task to more clearly reflect what it builds
This task has an input named "hello_hash.ml", and an output named
"hello_hash.jar".  So calling this task "generateHelloHash" is too
vague.  Now we call it "generateHelloHashJar" instead.
2018-04-17 15:02:36 -05:00
Ben Liblit 4f94b4c341 Extend Gradle's "clean" task to remove some additional build targets 2018-04-17 15:02:36 -05:00
Ben Liblit b4fca9c38d Merge info from existing, hand-authored manifests when building jars 2018-04-17 15:02:36 -05:00
Ben Liblit 272e3adaf8 Tell Eclipse to ignore some questionable manifest contents
These manifest files are here for use by the Maven build, but Eclipse
is now using Gradle (via Buildship).  So the manifests as seen by
Eclipse do not entirely make sense.  I'm hesitant to change the
manifests directly, since presumably they were correct for Maven and
still are.

Perhaps some day we'll be using Gradle to generate manifests.  Until
that day comes, we're better off leaving the manifests as they are and
just suppressing Eclipse's warnings instead.
2018-04-17 15:02:36 -05:00
Ben Liblit 9d7df5de7e After Builldship import, put "dx.jar" where the manifest expects it 2018-04-17 15:02:36 -05:00
Ben Liblit 7a5f140127 Restore old manifests in hope of fixing Maven regressions 2018-04-17 15:02:36 -05:00
Ben Liblit 4a707d954a Bail out if any Travis CI testing commands fail
Previously we could fail some "mvn" stage but keep running anyway,
thereby fooling us into thinking that everything was OK.
2018-04-17 15:02:36 -05:00
Ben Liblit 08dc11ad7d Incremental improvements to Windows JDK library configuration
This still doesn't actually work, but it's closer than it was before.
There's still some problem with improper mixing of 32-bit ("x86") and
64-bit ("x64") libraries.
2018-04-17 15:02:36 -05:00
Ben Liblit e8b86fdf82 Clean up questionable memory management during string construction
Avoid allocating memory using strdup() and then releasing it using
operator delete.  strdup()-allocated memory should be released using
free(), not delete.  But in these specific cases, there really was
never any good reason to duplicate the C-style strings in the first
place.  Instead, we can safely pass those NUL-terminated char pointers
directly in calls to JNI's NewStringUTF().  NewStringUTF() does not
take ownership of its argument, but rather clones that string data
internally before returning.  So using strdup() and delete was just
unnecessary memory churn.

In cases where we need to format, concatenate, or construct new
strings, don't use sprintf() into variable-sized, stack-allocated
arrays.  Variable-sized arrays are not portable, and in particular are
rejected by Microsoft's Visual Studio 2017 C++ compiler.  Instead, do
our string formatting and manipulations using std::ostringstream
and/or std::string.  We just need to be a bit careful about the
lifetimes and ownership responsibilities of allocated data.  In
brief, (1) ostringstream::str() returns a temporary string instance
that expires at the end of the enclosing statement, independent of the
lifetime of the ostringstream instance; while (2) string::c_str()
returns an pointer to internal data that remains valid as long as the
string on which it was called is valid and unmodified.
2018-04-17 15:02:36 -05:00
Ben Liblit 4b04f8d812 Somebody decided to use three-space indentation in this file only
OK, whatever makes you happy.
2018-04-17 15:02:36 -05:00
Ben Liblit e9fa6f31b3 Fill in likely (but untested) JVM library path on Windows 2018-04-17 15:02:36 -05:00
Ben Liblit 0a21f20348 Factor out common code for installing Android SDK components 2018-04-17 15:02:36 -05:00
Ben Liblit ad111547de Skip DroidBench tests on Windows, for now
The default location of DroidBench in "/tmp/DroidBench" does not work
well on Windows. So let's disable these tests until someone has time to
make that path more portable.
2018-04-17 15:02:36 -05:00
Ben Liblit f568db5de6 Fix Android SDK installation under Windows 2018-04-17 15:02:36 -05:00
Ben Liblit 7f8de6d611 Switch to a different DroidBench download URL
This URL skips over a redirect that the previous URL went through.
This URL also avoids an annoying "Invalid cookie header" warning that
the previous URL produced.
2018-04-17 15:02:36 -05:00
Ben Liblit e4f9fedf38 Use download task instead of "git clone" to get DroidBench
This gives us better progress reporting during the download, better
caching, better file-level dependency tracking, etc.
2018-04-17 15:02:36 -05:00
Ben Liblit 813c79caa0 Factor out recurring pattern in download tasks 2018-04-17 15:02:36 -05:00
Ben Liblit 4749fe47c0 Experimental combined task for download and checksum verification
Not working yet:
<https://github.com/michel-kraemer/gradle-download-task/issues/108>.
2018-04-17 15:02:36 -05:00
Ben Liblit ba455f4737 Update gradle-download-plugin and use some of its new features
We now download and verify checksums as a single task, rather than as
two separate tasks.  This simplifies other task dependencies, since we
no longer have a checksum-verified "stamp" file separate from the
download itself.  Unfortunately the combined task now has a
significant amount of repeated boilerplate.  I'm hoping to refactor
that all out into a custom task class, but haven't yet figured out the
details:
<https://github.com/michel-kraemer/gradle-download-task/issues/108>.

We now also use ETags to be smarter about when a fresh download is or
is not actually needed.  I think there are still opportunities for
improved caching here, but this is a step in the right direction.
2018-04-17 15:02:36 -05:00
Ben Liblit 17f42c3725 If Travis CI gives us multiple CPUs, we may as well use them
I believe Travis CI jobs get two CPUs by default.

Doing parallel builds regularly is also a good way to help us discover
any build race conditions we may have.  There's no guarantee that any
such races will be revealed, but even exposing them
nondeterministically is better than having no possibility of exposing
them at all.
2018-04-17 15:02:36 -05:00
Ben Liblit 96055cca75 Fix a shellcheck warning when setting a variable to the empty string 2018-04-17 15:02:36 -05:00
Ben Liblit 00a645100e Update to Gradle 4.6
No significant new features of interest for us in this release, but I
like to keep current.
2018-04-17 15:02:36 -05:00
Ben Liblit 596c9091bb Add a new README with Gradle-specific instructions and tips 2018-04-17 15:02:36 -05:00
Ben Liblit 29fad5b1e0 Remove two Maven repositories that we no longer use for anything
We used to use these to find various Eclipse packages, but that was
always a dodgy affair since we never quite knew whether we had
matching versions of everything.  Now that we are using the
"com.diffplug.gradle.p2.asmaven" plug-in, though, we have much better
control over getting exactly the Eclipse material we need.  These two
Maven repositories no longer provide anything we use, and therefore
can be removed.
2018-04-17 15:02:36 -05:00
Ben Liblit 43f7704d5d We only expect ".gradle" directories in two specific places 2018-04-17 15:02:36 -05:00
Ben Liblit 84f1977ab4 Generalize post-import Eclipse run configuration for more fixups
Previously this launcher's job was to run "processTestResources" and
any other Gradle tasks needed to create files that Eclipse was
expecting to be available.  But we also want to use it to revert the
bad changes that Buildship applies to ".launch" configuration files.

This is a temporary hack to work around
<https://github.com/eclipse/buildship/issues/653>.
2018-04-17 15:02:36 -05:00
Ben Liblit 5b1aed99a7 Minor indentation fix 2018-04-17 15:02:36 -05:00
Ben Liblit faf3b86e1b Extra help for finding "cast" native library on macOS
Unlike Linux, macOS has no "RPATH" facility for embedding additional
search paths within shared libraries.  Instead, we need to set
"DYLD_LIBRARY_PATH" appropriately in the environment.  This
environment variable is the macOS analogue of "LD_LIBRARY_PATH" on
Linux.

Note that adding the required path to the "java.library.path" system
property will *not* work.  This property only affects where the JVM
looks for shared objects that it is loading directly.  This property
does not influence the search for other, transitively-required shared
objects.

Fixes #3.
2018-04-17 15:02:36 -05:00
Ben Liblit cac0e87082 Fix remaining Javadoc warnings
This fixes the last of our Javadoc warnings without creating a
circular dependency between ":com.ibm.wala.cast:javadoc" and
":com.ibm.wala.cast.js:javadoc".  Fixes #4, wherein more details about
this tricky dependency challenge can be found.
2018-04-17 15:02:36 -05:00
Ben Liblit 709c38c049 Use ".singleFile" instead of "[0]" when we expect just one file
This documents our intent more clearly, and actively checks for
mistakes rather than silently ignoring unexpected extra files.
2018-04-17 15:02:36 -05:00
Ben Liblit e4f8d00cbe Start exploring publication features by adding source jar archives 2018-04-17 15:02:36 -05:00
Ben Liblit 2bf92e1214 Replicate test include/exclude patterns already used in Maven builds 2018-04-17 15:02:36 -05:00
Ben Liblit f287ee5c41 Add "com.ibm.wala.core.testdata" to classpath for testing
This lets the "DynamicCallGraphTest" tests pass.  The tests in that
class expect to find some element of the classpath that includes the
substring "com.ibm.wala.core.testdata".  They then treat that as a
collection of bytecode files to instrument.
2018-04-17 15:02:36 -05:00
Ben Liblit b8f1bb3aaf Skip a test intentionally; Maven already does the same
Big thanks to Julian for showing me where this exclusion logic lives
in the Maven configuration.  There's a "**/*AndroidLibs*.java"
exclusion pattern in the top-level "pom.xml".
2018-04-17 15:02:36 -05:00
Ben Liblit 2763589d1f Fix jar exclusion patterns to match what Ant uses
One previously-failing test class now passes.  Progress!
2018-04-17 15:02:36 -05:00
Ben Liblit d301a89f4f Add some Eclipse dependencies needed only when running tests
This allows two test classes to pass that previously were failing.
Yay!
2018-04-17 15:02:36 -05:00
Ben Liblit 06d464216b Add a resource directory containing a zip archive used for testing
The excluded test in this subproject still does not pass, though now
it's failing for a different reason than before.  Progress, I suppose!
2018-04-17 15:02:36 -05:00
Ben Liblit 7227deb8a9 Disable Gradle linter check for unused dependencies in Travis CI
It's telling me to remove "eclipse-deps:org.eclipse.core.runtime:+"
and "org.osgi:org.osgi.core:4.2.0" as unused dependencies in the
"com.ibm.wala.cast.java.ecj" subproject.  However, these two
dependencies (jar files) are actually needed; compilation fails
without them.
2018-04-17 15:02:36 -05:00
Ben Liblit 7e0ac84a03 Also get Eclipse JSDT from a P2 repository, but not the same one 2018-04-17 15:02:36 -05:00
Ben Liblit 5e0e251766 Find Eclipse jars using local Maven mirror of Eclipse P2 repository
This should give us a set of mutually-consistent jars rather than
picking up random, outdated pieces from Maven Central or wherever else
I could find them.  We now also have a single, central place where we
set the Eclipse version that we're building against.  Much, *much*
cleaner.
2018-04-17 15:02:36 -05:00
Ben Liblit 196dd2d971 Assume that Eclipse needs all standard test-resource processing 2018-04-17 15:02:36 -05:00
Ben Liblit d230fe836c Trivial whitespace tweak 2018-04-17 15:02:36 -05:00
Ben Liblit eb2d2dd850 Exclude one macOS test that I don't know how to fix right now 2018-04-17 15:02:36 -05:00
Ben Liblit e9ea4d7f1d Download appropriate Android SDK for current OS 2018-04-17 15:02:36 -05:00
Ben Liblit c02776fc4d Try to continue building/testing even after the first failure
If other, non-dependent tasks would also fail, I'd rather discover all
of them at once.
2018-04-17 15:02:36 -05:00
Ben Liblit fb33cbe03b "rm" on macOS apparently doesn't understand long ("--foo") flags 2018-04-17 15:02:36 -05:00
Ben Liblit cb72ebc177 macOS doesn't seem to have "xvfb-run", and may not need it anyway 2018-04-17 15:02:36 -05:00
Ben Liblit aff4067c39 Enable macOS (a.k.a. OS X) Travis CI testing for Gradle builds
We're not going to attempt macOS Travis CI testing for Maven builds,
because I don't know whether that's even expected to work on the
official WALA master branch.  Our main focus here is Gradle.

Note that Travis macOS images do not support JDK switching, so
explicitly selecting the JDK version now becomes part of the
Linux-only configuration.

Travis macOS images also do not support Android as a build "language".
So our Travis CI configuration for Gradle builds now declares that
this is a Java project rather than an Android one.  That's OK, though,
because our Gradle scripts already handle downloading the Android SDK;
we don't need Travis CI to do that for us.  When building using Maven,
though, we still call this an Android project because Maven builds do
still rely on Travis CI to provide the Android SDK.

squash! Enable macOS (a.k.a. OS X) Travis CI testing for Gradle builds
2018-04-17 15:02:36 -05:00
Ben Liblit 0e231b4363 Download a specific DroidBench release that we know works for us
If future DroidBench changes include things we need, then we can
decide to move to those newer revisions.  But we shouldn't allow
DroidBench to change out from under us implicitly whenever someone
commits something new to the DroidBench repository.
2018-04-17 15:02:36 -05:00
Ben Liblit 49eda8ffab Add "TODO" reminders of furture refactoring opportunities 2018-04-17 15:02:36 -05:00
Ben Liblit cdd4aac942 Factor out some repeated accesses to a task's output files 2018-04-17 15:02:35 -05:00
Ben Liblit 9b5cc743fe Derive Android platforms version from Android build-tools version
This should help us keep the two in sync if the latter changes one
day.
2018-04-17 15:02:35 -05:00
Ben Liblit 18a4edd84e Got DynamicDalvikComparisonJavaLibsTest working at some point 2018-04-17 15:02:35 -05:00
Ben Liblit ff8f6ec348 Ignore a transient file that appears during testing 2018-04-17 15:02:35 -05:00
Ben Liblit e3ebd87242 Grab an additional archive needed by DalvikAnnotationsTest 2018-04-17 15:02:35 -05:00
Ben Liblit 22acff5130 Download a few additional supporting files needed by tests 2018-04-17 15:02:35 -05:00
Ben Liblit d78d68176e Import a class that we will soon be using multiple times 2018-04-17 15:02:35 -05:00
Ben Liblit e529c9d96f Fix accidental copying of entire subproject as test resource 2018-04-17 15:02:35 -05:00
Ben Liblit e70ddf4dec Use an "android.jar" that matches the "dx.jar" we are already using
Nothing was obviously failing with the older "android.jar", but I feel
more comfortable knowing that these two are more closely matched.
2018-04-17 15:02:35 -05:00
Ben Liblit 1a82397fd7 Suppress harmless broken-pipe warnings from "yes" 2018-04-17 15:02:35 -05:00
Ben Liblit bcf685ba40 Set Android build-tools version in just one place 2018-04-17 15:02:35 -05:00
Ben Liblit b2fa87efe3 Use more recent "dx.jar" than is available through Maven Central
This lets us ditch pre-Java-8 in the Gradle build.  (The official WALA
master branch recently got rid of pre-Java-8 in its Maven build.)
That, in turn, lets two "com.ibm.wala.dalvik.test" tests pass that
previously were failing.  We still have two other failing tests in
that subproject, but this is definitely progress!

Our Gradle build scripts manage the entire process of downloading and
locally installing the appropriate Android SDK.  That includes
automatically accepting a license.  Maybe some lawyer will throw a fit
about that some day.  Until then, I'd rather have a build system that
does everything needed without imposing additional manual steps on
developers.
2018-04-17 15:02:35 -05:00
Ben Liblit 16c056f196 Ignore some transient files that appear during testing 2018-04-17 15:02:35 -05:00
Ben Liblit 9082a5205a Set name and version to help Gradle composite-build substitutions 2018-04-17 15:02:35 -05:00
Ben Liblit 2674806aa5 Update Eclipse JUnit test launchers for use with Buildship
Previously Buildship removed its classpath from all of these
launchers.  Now it's automatically putting that back in as soon as I
visit each launcher in Eclipse's "Run Configurations" dialog.  Not
sure what's going on here, but it certainly seems more sane to me to
assume that the Buildship-computed classpath *is* needed for all of
these.  I have an open question on the Gradle discussion forum to try
to understand what's going on here and how to fix it:
<https://discuss.gradle.org/t/launchers-lose-buildship-classpath-on-import-regain-it-later/25641>.
2018-04-17 15:02:35 -05:00
Ben Liblit 5de787bb2a Update Eclipse "Java Application" launchers for use with Buildship 2018-04-17 15:02:35 -05:00
Ben Liblit 83abb6a10a Use Eclipse-computed paths rather than hard-coding absolute paths 2018-04-17 15:02:35 -05:00
Ben Liblit b30da752e0 Remove launchers whose main Java code is found nowhere in WALA 2018-04-17 15:02:35 -05:00
Ben Liblit 557ea62426 Note some excessive resource copying that we should eventually fix 2018-04-17 15:02:35 -05:00
Ben Liblit 5b7e3f750e Create a broad "Process Test Resources" Eclipse launch configuration
This should prepare test resources for all subprojects.  A WALA
developer should run this once before running any tests inside
Eclipse.  Initially I'd hoped to make this more narrowly focused, but
Eclipse just doesn't have the infrastructure to deal with fine-grained
dependencies.  On the other hand, running "./gradlew
eclipsePrepareTestResources" automatically for each build seems like
overkill, and could end up being rather slow.  So for now we require
that the developer run this once, by hand.
2018-04-17 15:02:35 -05:00
Ben Liblit 62d7980ea3 Fix various warnings produced by "./gradlew javadoc"
Three stubborn warnings remain, but this is progress!
2018-04-17 15:02:35 -05:00
Ben Liblit 72a9ddd2d7 Fix warnings about Javadoc links to "java.lang.reflect" package 2018-04-17 15:02:35 -05:00
Ben Liblit 57e3dc15fa Trigger custom clean tasks whenever running "./gradlew clean"
A cleaned tree is now much closer to a pristine tree that has just
been checked out and never built.  The only extra created files that
are left behind are ".gradle", "buildSrc/.gradle", and
"buildSrc/build".
2018-04-17 15:02:35 -05:00
Ben Liblit 48fe74cba7 Unpack node.js in the same place that Maven unpacks it
This gets rid of some Eclipse warnings that stem from Buildship being
confused about what it should treat as a source directory if Maven and
Gradle are both being used in the same tree.
2018-04-17 15:02:35 -05:00
Ben Liblit 4809a365de Tweak Buildship-generated Eclipse ".project" file for extra jars 2018-04-17 15:02:35 -05:00
Ben Liblit ca5824a214 Update Gradle wrapper to Gradle 4.5
No major new features for us here, but better native caching and other
performance improvements.
2018-04-17 15:02:35 -05:00
Ben Liblit f7f8dd4351 Get a core test to work by putting "bcel-5.2.jar" where expected 2018-04-17 15:02:35 -05:00
Ben Liblit 2233d56d2a Get a Dalvik test to work by putting "dx.jar" where expected 2018-04-17 15:02:35 -05:00
Ben Liblit 9df594189d Compute a library path from the native software model
Previously we were repeating the library path twice, but that's not
good for long-term maintenance.  That being said, extracting this
information from the depths of the native software model seems *far*
more complex than it should be.  I had hoped for something nicer in
response to
<https://discuss.gradle.org/t/compute-wl-rpath-flag-suitable-for-native-shared-library/25278>,
but so far there's nothing.
2018-04-17 15:02:35 -05:00
Ben Liblit a3f524f7a9 Compute a library path from the corresponding linker task
Previously we were repeating the library path twice, but that's not
good for long-term maintenance.
2018-04-17 15:02:35 -05:00
Ben Liblit 2a6eee85a4 rpath only matters for shared libraries 2018-04-17 15:02:35 -05:00
Ben Liblit 3b8e32b322 Add previously-undeclared dependency of tests on native library 2018-04-17 15:02:35 -05:00
Ben Liblit b2ba188176 Avoid random leftover junk by using "Sync" instead of "Copy" 2018-04-17 15:02:35 -05:00
Ben Liblit 1b4e04be6a Simplify filtering of archive contents 2018-04-17 15:02:35 -05:00
Ben Liblit df8a61a8d7 Override specific "cleanFooBar" tasks instead of generic "clean" 2018-04-17 15:02:35 -05:00
Ben Liblit 84b0846517 Be more concise by calling property setters instead of assigning 2018-04-17 15:02:35 -05:00
Ben Liblit d3ddbd6343 Be more concise by omitting implicit "it." in closures 2018-04-17 15:02:35 -05:00
Ben Liblit f12f5faa83 Change archive file names while unpacking, rather than in two stages 2018-04-17 15:02:35 -05:00
Ben Liblit 016538b688 Use Groovy's implicit "it" closure argument 2018-04-17 15:02:35 -05:00
Ben Liblit 3b4ae0f210 Remove leftover debugging output that I no longer need 2018-04-17 15:02:35 -05:00
Ben Liblit cad94b7076 Download "android-4.1.1.4.jar" (as "android.jar") when needed
Previously Maven did this, but Gradle did not.  So Gradle testing
would only succeed if we'd already done a Maven build first.  Now
these tests pass in a fresh tree that's never seen a Maven build.
2018-04-17 15:02:35 -05:00
Ben Liblit 141e4a6b41 Simplify how we refer to a task's only output 2018-04-17 15:02:35 -05:00
Ben Liblit f628ee1e08 Don't bother importing when we only need one symbol, one time 2018-04-17 15:02:35 -05:00
Ben Liblit 8058acb18b Download NodeJS and include its "lib/*.js" files in jar archive 2018-04-17 15:02:35 -05:00
Ben Liblit aabace3241 Remove "extraBundledJars" task, which nothing else actually uses
Some tests in other subprojects do depend on some these extra jar
files.  But they can declare those specific dependencies as needed.
Nothing seems to depend on the entire group of extra jars, so it's not
really useful to declare a task that is merely an alias for all of
them.
2018-04-17 15:02:35 -05:00
Ben Liblit 3b172370d0 Set working directory in the same way Maven does
This seems to help ECJSyncDuplicatorTest find a "./src/Monitor2.java"
file that it needs.  The test still fails, though, for other reasons.
2018-04-17 15:02:35 -05:00
Ben Liblit b24f60e727 Enable a few more tests that started working, or perhaps always did 2018-04-17 15:02:35 -05:00
Ben Liblit 60870d7231 Factor out recurring pattern of MD5 checksum + stamp file 2018-04-17 15:02:35 -05:00
Ben Liblit 2c1bc5c52c Replicate Maven's extra system property settings for some tests 2018-04-17 15:02:35 -05:00
Ben Liblit 9c58a94056 Add missing test resources to make many more regression tests pass 2018-04-17 15:02:35 -05:00
Ben Liblit 9d9b10cd0a Remove some test exclusions that are not actually needed now 2018-04-17 15:02:35 -05:00
Ben Liblit b1f0cfce15 Replicate Maven's heap size limits for tests 2018-04-17 15:02:35 -05:00
Ben Liblit 737e948640 Buildship removed classpath provider thing from more launch configs
This is more of the same sort of change first seen in a1bd95d.  Still
no idea why it happens; still hoping that Buildship knows what it's
doing.
2018-04-17 15:02:35 -05:00
Ben Liblit bde936eec5 Turn on proper regression testing in Travis-CI
Many tests are excluded until
<https://github.com/liblit/WALA/issues/5> is fixed.  But we can at
least have Travis-CI watching over our shoulder to ensure that
no *new* regressions sneak into the tree.
2018-04-17 15:02:35 -05:00
Ben Liblit e2e340b490 Explicitly disable regression tests that are currently failing
<https://github.com/liblit/WALA/issues/5> notes that several
subprojects' tests are currently broken under Gradle.  I'd still like
to be able to run non-broken tests, though.  So here I'm disabling the
failing tests.  The intent is to treat these exclusions as a to-do
list.  We can remove exclusions as we get the corresponding tests
working.  No more exclusions means
<https://github.com/liblit/WALA/issues/5> is fixed.
2018-04-17 15:02:35 -05:00
Ben Liblit 6a4ed60e9a Explicitly make "/tmp/DroidBench" be a file, not just a string
I'm hoping this might remove some seemingly-spurious reruns of this
task.  Still not sure why those are happening, though.
2018-04-17 15:02:35 -05:00
Ben Liblit 56b3c1d37c Do not run Gradle linter by default
It's rather slow, adding roughly five seconds to every "./gradlew"
invocation.  And the advice it gives might not even be reaching a
fixed point.  I like the idea of running the linter as part of CI
testing, but I now think it's overkill to impose on every developer
build.
2018-04-17 15:02:35 -05:00
Ben Liblit 582fb2a97b Dependency tweaks suggested by Gradle linter
I'm starting to wonder whether the linter might be driving us in
cycles rather than reaching a fixed point.  We should keep our eyes on
this.
2018-04-17 15:02:35 -05:00
Ben Liblit a32a3e3191 Teach Gradle how to download "/tmp/DroidBench" when needed
One less thing for developers to have to remember to do manually!
2018-04-17 15:02:35 -05:00
Ben Liblit 75270b18ca Give each verification task an output for better incremental building 2018-04-17 15:02:35 -05:00
Ben Liblit 365d17bf32 Simplify how we refer to existing tasks 2018-04-17 15:02:35 -05:00
Ben Liblit e654e3dd16 Add missing resources for "com.ibm.wala.cast.js.test" tests
The ":com.ibm.wala.cast.js.test:build" task now passes.
2018-04-17 15:02:35 -05:00
Ben Liblit 6fec4bba94 RPath settings apply only to Linux; some only to Linux on x86_64
I don't know whether Windows or MacOS needs anything similar.  If they
do, the details will differ, and should be handled by adding suitable
cases to these switch statements.
2018-04-17 15:02:35 -05:00
Ben Liblit 23a301cfff Correctly declare dependency on a task that has not been defined yet 2018-04-17 15:02:35 -05:00
Ben Liblit 6baa918963 Dependency tweaks suggested by Gradle linter
This partially reverts 72bc456b7.  I'm starting to wonder whether the
linter might be driving us in cycles rather than reaching a fixed
point.  We should keep our eyes on this.
2018-04-17 15:02:35 -05:00
Ben Liblit e4cc086476 Simplify file management for a download task 2018-04-17 15:02:35 -05:00
Ben Liblit cf9281719a Download, extract, and/or construct various additional bundled jars
I don't really know what these are all used for.  However, Maven+Ant
builds them, so for now Gradle should too.
2018-04-17 15:02:35 -05:00
Ben Liblit e32b495354 Prefer single-quoted (non-interpolated) strings where sufficient 2018-04-17 15:02:35 -05:00
Ben Liblit be8f22145e Teach Gradle how to find and copy a Jar archive that we bundle
I'm not actually sure why this archive is needed, except that it is
mentioned in "META-INF/MANIFEST.MF" and "build.properties".  If we
eventually stop supporting Maven, then we may be able to discard the
"copyJarsIntoLib" task and the corresponding lines in
"META-INF/MANIFEST.MF" and "build.properties"
2018-04-17 15:02:35 -05:00
Ben Liblit fd4d68d278 Buildship removed classpath provider thing from all launch configs
This consistently happens when I import WALA as an existing Gradle
project into Eclipse with Buildship.  I don't really know what this
change means, or whether it's desirable.  For now, I'm going to trust
Buildship and see what happens.
2018-04-17 15:02:35 -05:00
Ben Liblit 0d557aec3b Complain more loudly about missing output directories 2018-04-17 15:02:35 -05:00
Ben Liblit 18e34918d5 This is no longer how we'll build the native library in Eclipse 2018-04-17 15:02:35 -05:00
Ben Liblit 8f52ab8d36 Simplify inclusion of "OSGI-INF" and the only file it contains 2018-04-17 15:02:35 -05:00
Ben Liblit d14d40ee3f Tweak output dirs to match what Buildship puts into ".classpath" 2018-04-17 15:02:35 -05:00
Ben Liblit 51c9e062f4 Disable some Eclipse warnings on Java test inputs
I think these were previously not being compiled at all.  Now, with
Buildship generating Eclipse ".project" settings automatically, these
are being processed.  In general we don't care much about questionable
code in test data, though.
2018-04-17 15:02:35 -05:00
Ben Liblit efd3a6ab18 Let Buildship create new settings files when importing
These settings files currently are generated with an initial timestamp
comment line, which is not something we'd want to track in version
control.  Fortunately, the contents of these files are entirely
mundane, so there should be no problem with having Buildship generate
them anew each time a developer imports WALA into Eclipse as an
existing Gradle project.
2018-04-17 15:02:35 -05:00
Ben Liblit da27efec97 Have Buildship add Eclipse plugin (PDE) nature to some subprojects
Specifically, we need this for subprojects that build included plugins
for any of the "*_feature" subprojects.
2018-04-17 15:02:35 -05:00
Ben Liblit be11083cd8 Exclude Eclipse ".project" and ".classpath" from version control
Apparently Buildship generates these when one uses Import -> Existing
Gradle Project:
<https://discuss.gradle.org/t/buildship-eclipse-plug-in-multiproject-builds/24030/5>.
We can use the Gradle "eclipse" plugin if customizations are
necessary, but my impression is that the intent is to treat ".project"
and ".classpath" as generated files, not sources to be tracked in
source control.
2018-04-17 15:02:35 -05:00
Ben Liblit 2753810958 Update Gradle wrapper to latest version (4.4.1) 2018-04-17 15:02:35 -05:00
Sungho Lee 41fe177e89 Fill the dynamic library path for OSX 2018-04-17 15:02:35 -05:00
Sungho Lee 2e03ded0f8 Fill the dynamic library path for OSX 2018-04-17 15:02:35 -05:00
Ben Liblit 2bc0768242 Simplify loading of plugins shared by many subprojects 2018-04-17 15:02:35 -05:00
Ben Liblit db348b4ddd Clean up some simple syntactic redundancy in dependency declarations 2018-04-17 15:02:35 -05:00
Sungho Lee a185ae500e Check Java version 2018-04-17 15:02:35 -05:00
Sungho Lee 6016bfa21f Remove unused dependencies 2018-04-17 15:02:35 -05:00
Ben Liblit 95d7bf775e Better handling of OS- and architecture-specific JDK paths 2018-04-17 15:02:35 -05:00
Ben Liblit 4b6c26eb07 Add various test resource directories
Unfortunately these tests are still not finding their resources
properly at test run time.  I don't know why.  It seems to have
something to do with how the tests instantiate and use class loaders.
I'm probably going to need expert help with this.
2018-04-17 15:02:35 -05:00
Ben Liblit e9a79212c8 Dependency tweaks suggested by Gradle linter 2018-04-17 15:02:35 -05:00
Ben Liblit e64fbc7050 Find the "xlator_test" shared library at test run time
Dependencies are still not set properly here, so you need to have
built the shared library ("./gradlew xlator_testSharedLibrary") before
running the ":com.ibm.wala.cast.test:test" test task.  But at least
the tests do now find and load that shared library properly.
2018-04-17 15:02:35 -05:00
Ben Liblit 651f40c170 Replace source directories rather than appending to them
I was confused about the differences among:

	srcDir 'foo'
	srcDirs ['foo']
	srcDirs = ['foo']

As it turns out, the first two append to the set of source
directories, while the last replaces this set entirely.  I generally
want replacement, since WALA's current directory layout never matches
Gradle's assumed defaults.
2018-04-17 15:02:35 -05:00
Ben Liblit f7c7419351 Cleaner way to form colon-deliminated search path from list of paths 2018-04-17 15:02:35 -05:00
Ben Liblit 5f513fd643 Cleaner approach to augmenting Javadoc classpath 2018-04-17 15:02:35 -05:00
Ben Liblit e23e6786da Start getting some unit tests to pass
The main requirement here is to arrange for the proper classpath
settings when tests are running so that they can find any associated
resources (i.e., other supporting files).
2018-04-17 15:02:35 -05:00
Ben Liblit a81d583cbf Tweak classpath for some Javadoc build tasks
This comes up when the Javadoc comments refer to classes in other
subprojects that the corresponding Java code did not actually depend
upon.
2018-04-17 15:02:35 -05:00
Ben Liblit 1a3a1570af Declare common library dependencies for source sets, not binaries
No sense repeating this for each binary when it's the same for all of
them.
2018-04-17 15:02:35 -05:00
Ben Liblit 35e04bc598 Add a second native library and a native executable 2018-04-17 15:02:35 -05:00
Ben Liblit df2e39b0fc Add Gradle logic for building a native library
This approach uses no external makefiles; it's pure Gradle.  Nice!
2018-04-17 15:02:35 -05:00
Ben Liblit 3f3de7a7fa Compile test code, but don't run it for now
The tests are currently broken due to some sort of problem using class
loaders to find supporting resources.  Until I figure this out, better
to have Travis-CI verify only the things we think work.
2018-04-17 15:02:35 -05:00
Ben Liblit aae1c2230a Consistently use simple sorted order for dependencies
This isn't even sorting by library or subproject name.  It's just a
dumb textual sort of the contents of each line.
2018-04-17 15:02:35 -05:00
Ben Liblit 336f0c04ad Leave Gradle linter turned on by default, now that it's quieter 2018-04-17 15:02:35 -05:00
Ben Liblit 695cd2863c Properly distinguish main from test code, now that I know how 2018-04-17 15:02:35 -05:00
Ben Liblit a276932a10 Selectively disable some Gradle linter rules
Specifically, we're not really in a position now to deal with
duplicated classes among our dependencies.  Maybe we can try harder to
examine those in the future, but for now they are a distraction from
other issues that we can attack more readily.
2018-04-17 15:02:35 -05:00
Ben Liblit 143698bbe5 Split generic Java setup from OSGi substitution setup 2018-04-17 15:02:35 -05:00
Ben Liblit 74e39ce101 Automated Gradle-driven download of JLex test input 2018-04-17 15:02:35 -05:00
Ben Liblit 777509adbc Disable Javadoc linter for now
Some of the linter's checks produce failures (errors) when Gradle
builds the Javadoc documentation.  Fixing them isn't really a Gradle
issue, though, so I don't want to deal with them now.
2018-04-17 15:02:35 -05:00
Ben Liblit 0c24fde2ef Improve documentation for broad sections of top-level build script 2018-04-17 15:02:35 -05:00
Ben Liblit 4bb91b4bba More Gradle dependency clean-ups suggested by linter
Unfortunately the linter does not reach a fixpoint if you keep trying
to apply its suggestions.  If you include "compile
'org.eclipse.core:org.eclipse.core.runtime:3.10.0.v20140318-2214'" in
the dependencies for "com.ibm.wala.ide.jdt", then the linter tells you
that this dependency is unused and can be removed.  If you remove it,
then the linter tells you that it should be added.  Sigh.
2018-04-17 15:02:35 -05:00
Ben Liblit 9ac69fb0ef Fix a tricky cross-subproject Javadoc dependency
By default, each subproject's Javadoc task depends on the same
subproject's Java compilation task, and uses the same classpath.
Thus, any classes that some Java code uses will also be visible when
building the same Java code's documentation.

In this case, we need to see one of the "com.ibm.wala.core" classes in
order to build the "com.ibm.wala.util" documentation.  However, we
cannot have Java compilation of "com.ibm.wala.util" depend on Java
compilation of "com.ibm.wala.core", because that would create a
dependency cycle.  So we need to add this as a special dependency just
for the "com.ibm.wala.util" documentation task, and add the
appropriate classpath as well.

I'm quite proud of myself for figuring out how to do this properly.
2018-04-17 15:02:35 -05:00
Ben Liblit 781a448a9a In Travis-CI, test Maven and Gradle separately and concurrently
This should help identify cases where the Gradle build only works if
it runs before or after a Maven build.  It will also help us recognize
any Maven regressions accidentally introduced by our Gradle work.
2018-04-17 15:02:35 -05:00
Ben Liblit dcc7677b34 Add a Gradle linter to help me write clean build configurations
The linter does not run by default.  To activate it, use "./gradlew
autoLintGradle".
2018-04-17 15:02:35 -05:00
Ben Liblit b94390f2fe Additional explicit dependencies suggested by Gradle linter 2018-04-17 15:02:35 -05:00
Ben Liblit 54a2878b0f Automated Gradle-driven download of AJAXSLT test inputs
I'm not sure that I am doing this in the best way possible.  But it
seems to be working.  Refinements are welcome!
2018-04-17 15:02:35 -05:00
Ben Liblit 651a0d4d82 Add Gradle build script for a subproject that previously had none 2018-04-17 15:02:35 -05:00
Ben Liblit 25e2201ec6 Add Gradle build script for a subproject that previously had none 2018-04-17 15:02:35 -05:00
Ben Liblit 7af7bbf881 Add Gradle build script for a subproject that previously had none 2018-04-17 15:02:35 -05:00
Ben Liblit 603378cd0b Add Gradle build script for a subproject that previously had none 2018-04-17 15:02:35 -05:00
Ben Liblit b6e4939097 Add Gradle build script for a subproject that previously had none 2018-04-17 15:02:35 -05:00
Ben Liblit 22b59de491 Add a direct dependency that previously we picked up transitively 2018-04-17 15:02:35 -05:00
Ben Liblit 045b9f646c Run a Gradle build after the Maven build
Eventually I'll want to swap that order, so that we know that Gradle
builds work even without any help from Maven build setup logic.  For
now, though, I just want to test whether the Gradle build works at
all.
2018-04-17 15:02:35 -05:00
Ben Liblit 401fbaf89a Many improvements to Gradle build support, including within Eclipse 2018-04-17 15:02:35 -05:00
Sungho Lee e7154b9ac7 change hamcrest library version of core.tests 2018-04-17 15:00:03 -05:00
Sungho Lee 69f0a93fb6 Support the gradlew build 2018-04-17 15:00:03 -05:00
Sungho Lee 6dceb3d8ef Change build.gradle files for proper format and delete all tests 2018-04-17 15:00:03 -05:00
Sungho Lee 04923544f0 Gradle build scripts 2018-04-17 15:00:03 -05:00
Julian Dolby 3b3a97e8af
Merge pull request #293 from liblit/remove-cvs-ignore
WALA uses Git, so CVS ignore patterns are moot
2018-04-14 21:49:40 -04:00
Ben Liblit 4bb4a3104a WALA uses Git, so CVS ignore patterns are moot 2018-04-14 19:08:14 -05:00
Julian Dolby 883b7282f4
Merge pull request #287 from pierlauro/master
Protected visibility for JavaSourceLoaderImpl's internal methods and classes
2018-04-13 17:02:24 -04:00
Julian Dolby 726b3c35ce
Merge pull request #292 from liblit/fix-raw-types-warnings
Resolve the last two Eclipse warnings about using raw types
2018-04-13 17:01:52 -04:00
Ben Liblit 6546d5d6a4 Resolve the last two Eclipse warnings about using raw types
Fixes bug #244.
2018-04-13 12:53:33 -05:00
Julian Dolby 0052213542 build ML projects 2018-04-13 09:11:57 -04:00
Julian Dolby 436d3165f7 rename getNumberOfParameters to getNumberOfPositionalParameters since the Python front end now supports keyword parameters
support variable names in IR for synthetic summaries
2018-04-12 19:09:25 -04:00
Julian Dolby 41d254d547 more type parameters for analysis engine 2018-04-10 16:00:44 -04:00
Achim D. Brucker f6c663c238 Merge remote-tracking branch 'upstream/master' 2018-04-05 23:19:36 +01:00
Pierlauro Sciarelli 886ba11c1e Protected visibility for JavaSourceLoaderImpl's internal methods and classes 2018-03-08 15:52:20 +01:00
Julian Dolby e2c1f72a3e
Create LICENSE 2018-03-08 09:08:53 -05:00
Ben Liblit 0512241027 Use the proper JUnit mechanism for conditionally skipping tests
These are slow tests that we were already effectively turning into
no-ops when running on Travis CI.  By skipping them using the proper
JUnit mechanism, these tests will show up as ignored or skipped in
test outcome reports.  That's better than having them show up as
passing, when we really don't know whether they would have passed or
failed.
2018-03-05 11:22:49 -08:00
Julian Dolby 6cb72ad2b8 fixes to make PropagationGraph and friends easier to use in dataflow problems 2018-03-02 15:29:42 -05:00
Julian Dolby e1def2ffb5 more generalization for reuse 2018-02-17 22:08:09 +01:00
Julian Dolby be6bb3dc9a a little more work on summaries 2018-02-14 18:54:21 -05:00
Julian Dolby 6c1d0d9cb6 more work for reuse
make synthetic code better support non-Java languages
2018-02-14 09:00:07 -05:00
Ben Liblit 81a6e67b4b Remove "@param" Javadoc tags for parameters that no longer exist 2018-02-10 18:08:15 -08:00
Julian Dolby 7d76e20d2a try to find dx.jar 2018-02-05 15:43:49 -08:00
Julian Dolby aa414b3503 abandon hackish profiles 2018-02-05 15:26:08 -08:00
Julian Dolby c8cdaf8616 further refactoring to enable more reuse
eliminate all non-jva 8 compilation
2018-02-05 15:18:37 -08:00
Julian Dolby b7d9d037a6 more refactoring for reuse 2018-01-30 14:08:25 -05:00
Julian Dolby 0f3b6f5d7e disable debugging properly 2018-01-25 15:18:17 -05:00
Julian Dolby cd944a8f12 refactoring of CAst front end machinery to allow more reuse 2018-01-25 14:42:27 -05:00
Julian Dolby 8796653292 Merge branch 'master' of https://github.com/wala/WALA 2018-01-23 19:57:37 -05:00
Julian Dolby 9c29f59e21 merge 2018-01-23 19:57:34 -05:00
Julian Dolby 742b42efdf native config cleanup 2018-01-20 17:40:10 +00:00
Ben Liblit 372f0bd5d8 Fix several broken cross-references in Javadoc comments 2018-01-17 10:35:49 -08:00
Manu Sridharan 76faa4df2d
Fix bug with method lookup (#276)
The previous lookup logic would erroneously look in superclasses for a constructor with parameters.

Bug reported on [the mailing list](https://groups.google.com/forum/#!msg/wala-sourceforge-net/6m_VmDF-lZ0/erZIYQ68BwAJ;context-place=topic/wala-sourceforge-net/TjRzdDyljjY)
2017-12-23 16:38:26 -08:00
Julian Dolby a19507312a
Merge pull request #274 from ponder-lab/upstream_master2
Fix Atom.startsWith() failure case.
2017-12-20 22:45:18 +00:00
Julian Dolby d9cd362f8b
Merge pull request #275 from liblit/fix-javadoc-miscellaneous
Fix various Javadoc errors
2017-12-20 22:44:11 +00:00
Ben Liblit 0a770ce7ab "@todo" is not a valid Javadoc tag 2017-12-19 16:53:56 -06:00
Ben Liblit 73e6291a8a Fix bad split of "<a>" across multiple comment lines 2017-12-19 16:53:56 -06:00
Ben Liblit 4cf2dac911 Fix missing "#" when using "@link" to refer to same-class member 2017-12-19 16:53:56 -06:00
Ben Liblit 0d6d9f2b2e Remove useless "@return" tags with no descriptive text 2017-12-19 16:53:56 -06:00
Ben Liblit 85ca6424b1 "@link" does not allow generic type parameters in method signatures 2017-12-19 16:53:56 -06:00
Ben Liblit c50dd6302f "<\tt>" is not how you close an HTML "<tt>" tag 2017-12-19 16:53:56 -06:00
Ben Liblit 4ad5322ebf Add missing right curly brace at end of "{@link ...}" 2017-12-19 16:53:55 -06:00
Ben Liblit 9072560a22 HTML lists must not have free-floating text between list items 2017-12-19 16:53:55 -06:00
Ben Liblit a7f00ffce8 "@param" parameter name must match the name of some formal parameter 2017-12-19 16:53:55 -06:00
Ben Liblit ba71f45119 "@throws" should be followed by class name and space, not comma 2017-12-19 16:53:55 -06:00
Ben Liblit ca23fc5b91 "@brief" is not a valid Javadoc tag 2017-12-19 16:53:55 -06:00
Ben Liblit d8b041469f "@returns" is not a valid Javadoc tag, but "@return" is 2017-12-19 16:53:55 -06:00
Ben Liblit ce403cef2b "@throw" is not a valid Javadoc tag, but "@throws" is 2017-12-19 16:53:55 -06:00
Ben Liblit fa62aa03e6 "<verbatim>" is not a valid HTML tag; perhaps "<pre>" was intended? 2017-12-19 16:53:55 -06:00
Ben Liblit 6beaac98bd "<bf>" is not a valid HTML tag, but "<b>" is 2017-12-19 16:53:55 -06:00
Ben Liblit f60c164ec1 Escape "<" and ">" in Javadoc when not used as HTML tag syntax 2017-12-19 16:53:52 -06:00
Raffi Khatchadourian fc62c16d9b Fix https://github.com/wala/WALA/issues/273. 2017-12-19 16:58:48 -05:00
Julian Dolby d29e278291 more instrumentation fixes
remove junk from dominators
2017-12-08 11:19:41 +08:00
Julian Dolby 5a02cde690 more flexibility to not extract calls for invokedynamic. Potentially, this will break instrumented methods that have massive numbers of invokedynamics in them, but that seems unlikely to happen at least with Java use of invokedynamic so far. We can burn this bridge when we come to it. 2017-12-06 19:04:27 +08:00
Ben Liblit 0286c2b048 Use Iterator2Iterable helper to convert more loops to for-each 2017-12-04 14:04:39 -08:00
Ben Liblit bf6698edf5 Use more specific type than "Object" to avoid casting 2017-12-04 14:04:39 -08:00
Ben Liblit 66e2e76205 Prefer to cast Iterables instead of the things they can iterate over 2017-12-04 14:04:39 -08:00
Ben Liblit 544a71ae72 Remove type arguments that Java 1.7+ can infer for us 2017-12-04 14:04:39 -08:00
Ben Liblit b25e461bfe Convert a few more loops into modern for-each loops 2017-12-04 14:04:39 -08:00
Julian Dolby da4247f923 add HybriDroid to testing 2017-12-04 17:15:34 +08:00
Julian Dolby 0ea98643f3 revert lambdas thait cause trouble with WALA Mobile. It may be that the
issue is Swing, since I think that is not on Android.
2017-12-03 11:31:29 +08:00
Julian Dolby b68ff20c82
Merge pull request #269 from liblit/modernization-java-8-lambdas-and-method-references
Use Java 8 lambdas and method references wherever possible
2017-12-03 09:54:09 +08:00
Julian Dolby 4a53da36ea fix type-o 2017-12-01 20:22:37 +08:00
Julian Dolby 803243ea53 Merge branch 'master' of https://github.com/wala/WALA 2017-12-01 20:02:00 +08:00
Julian Dolby 7cd2a2acf8 Fixes for instrumentation of invoke dynamic 2017-12-01 20:01:16 +08:00
Julian Dolby d685fbb71f Add Jeff's group's incremental pointer analysis project to trigger 2017-12-01 13:05:25 +08:00
Ben Liblit 9c83e87cc1 Merge branch 'master' into modernization-java-8-lambdas-and-method-references 2017-11-29 10:51:33 -06:00
Julian Dolby 6be349096c
Merge pull request #271 from liblit/modernization-loops-and-iterators
Modernize loops and iterators
2017-11-29 04:30:28 -05:00
Ben Liblit ebfd885d22 Use modern for-each loops where possible
Java sources used as test data have been excluded from this mass
clean-up.
2017-11-28 14:44:53 -06:00
Ben Liblit 12ca05ddb7 Enforce not using raw types more forcefully where possible
These are all modules where no such warnings currently arise.  If any
arise in the future, then, let's treat them as errors so we keep
things clean.
2017-11-28 14:09:42 -06:00
Ben Liblit 8ef6ad5069 Add proper type parameters to nearly all uses of Iterator
Java sources used as test data have been excluded.
2017-11-28 14:09:30 -06:00
Ben Liblit 456b0e45c3 Remove additional unnecessary casts of lambda expressions 2017-11-27 15:00:13 -06:00
Ben Liblit 5bc0e11e90 Ignore invalid Javadoc here, in case we don't have Android's SDK 2017-11-27 11:31:15 -06:00
Ben Liblit 6261880264 Remove unnecessary casts of lambda expressions 2017-11-27 11:31:15 -06:00
Ben Liblit 16913ffc80 Remove an apparently-useless no-op walk over elements of a set 2017-11-27 11:31:15 -06:00
Ben Liblit 2e084bdec7 Use existing IteratorUtil.filter when that's exactly what we need 2017-11-27 11:31:15 -06:00
Ben Liblit b2e1081221 Clean up IteratorUtil.filter
Use method references where possible.  Remove no-longer-needed
annotations.
2017-11-27 11:31:15 -06:00
Ben Liblit 5fa3643652 Don't suppress javadoc warnings; these are disabled entirely anyway 2017-11-27 11:31:15 -06:00
Ben Liblit de2690dfac Remove two imports that are no longer used 2017-11-27 11:31:15 -06:00
Ben Liblit 4b81b69165 Disable annotation-based nullness analysis
Using constructor references apparently pulls in something involving
nullness annotations.  However, we don't actually build with a jar
file that defines those annotations, so this leads to Eclipse build
failures.  I don't know the right way to add such a jar file to our
current configuration mishmash of Ant, Maven, and Eclipse.  So the
easier thing to do is just disable annotation-based nullness analysis.
I doubt we were getting any benefit from such an analysis anyway,
given that WALA itself doesn't use those annotations at all.
2017-11-27 11:31:15 -06:00
Ben Liblit 74e0640771 Replace simple lambdas with method references wherever possible 2017-11-27 11:31:15 -06:00
Ben Liblit 790d37781b Convert many single-method anonymous classes to lambdas
Eclipse's automated code clean-up tool did most of the heavy lifting
here: it specifically has a clean-up option for converting functional
interfaces to lambdas.  I merely had to revert the automated changes
for a single enumeration class for which it produced invalid results,
and for a few test inputs that apparently aren't set up to be compiled
with Java 8.
2017-11-27 11:31:15 -06:00
Ben Liblit 28f0e09435 Make FilterIterator and Predicate statically type-correct
Previously FilterIterator was very permissive regarding the type
relationships between the original iterator, the filtered iterator,
and the predicate used to prune the former down to the latter.  Now we
enforce those relationships more strictly, including proper use of
covariant ("<? extends T>") and contravariant ("<? super T>")
polymorphic type parameters where appropriate.

This lets us get rid of seven suppressed warnings about generic types
and/or unchecked conversions.  It also moves us toward being able to
use modern Java features like lambdas and streams more easily.
2017-11-27 11:31:14 -06:00
Julian Dolby 5ac8bf881d
Merge pull request #265 from liblit/java-8-build-configuration
Update more parts of the build configuration to use Java 8
2017-11-26 20:53:28 -05:00
Ben Liblit 11828c57f4 Update more parts of the build configuration to use Java 8
Julian Dolby assures me that WALA is now supposed to be using Java 8
everywhere.  This covers nearly all remaining places that I can find
where an earlier Java version was still being used.  (The few
exceptions are places where switching to Java 8 causes test failures.
I'll address those separately, probably by reaching out to the WALA
maintainers for help.)
2017-11-26 18:46:00 -06:00
Ben Liblit 9ef6ff1a9c Remove "build.xml" files not used by corresponding "pom.xml" files 2017-11-26 18:11:56 -06:00
Ben Liblit ded9e880b1 Update Maven Central configurations to also use Java 8 (#264)
E-mail exchanged with Julian Dolby suggests that this is the right
thing to do, and that it should have been done back when we converted
other parts of the build configuration to Java 8.
2017-11-23 12:55:05 -08:00
Julian Dolby 49b5fe83b5 Merge branch 'master' of https://github.com/wala/WALA 2017-11-22 20:15:10 -05:00
Julian Dolby 45da66a95d cleanups and changes for TAMU work 2017-11-22 18:24:39 -05:00
Ben Liblit e89c5c6562 Disable deprecation warnings in modules where they are unavoidable (#263)
These two modules refer to "AST.JLS8".  If you have Java 9 installed,
then "AST.JLS8" is marked as deprecated, and we can a warning unless
we suppress or disable the deprecation warning wherever "AST.JLS8" is
used.  However, if you don't have Java 9 installed, then "AST.JLS8" is
not deprecated, and trying to suppress deprecation warnings where
"AST.JLS8" is used instead produces warnings about unnecessary warning
suppression.  Aagh!  Turning off the deprecation warnings entirely for
these two modules seems like the only sane compromise.
2017-11-21 18:00:43 -08:00
Julian Dolby 5faae993e9
Merge pull request #261 from liblit/warning-fixes-deprecated-AST-JLS8
Suppress deprecation warnings about requesting an old AST version
2017-11-19 17:41:59 -05:00
Julian Dolby 96559826c2
Merge pull request #262 from liblit/warning-fix-unnecessary-default-encoding
Remove a default encoding setting that Eclipse considers unnecessary
2017-11-19 17:41:20 -05:00
Ben Liblit 221a1a26ed Remove a default encoding setting that Eclipse considers unnecessary
Removing fixes one Eclipse error diagnostic: "Default encoding (UTF-8)
for library '.' should be removed as the workspace does not specify an
explicit encoding."

This reapplies the fox from ecd1ff72fe,
which was reverted (apparently unintentionally) as part of a larger
group of changes in 8d65788aef.
2017-11-19 15:46:40 -06:00
Ben Liblit d79707e137 Suppress deprecation warnings about requesting an old AST version
Near as I can tell, the requests for deprecated versions here are
intentional.  The non-deprecated version (AST.JLS9) is the latest and
greatest, but as far as I can tell we really do want the older version
here.

This is similar to 6caecce3e7, though in
that case JLS8 was the non-reprecated latest version and we were still
asking for JLS3.
2017-11-19 15:43:45 -06:00
Raffi Khatchadourian 1d239dac52 Remove explicit super call (#252) 2017-11-18 09:19:43 -05:00
1035 changed files with 11771 additions and 10606 deletions

6
.dir-locals.el Normal file
View File

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

78
.gitignore vendored
View File

@ -4,42 +4,48 @@
*.swp
*/bin/
*/bin/*
*/build/
*~
.classpath
.metadata/
com.ibm.wala.cast/lib/
com.ibm.wala.cast.java.jdt.test/
com.ibm.wala.cast.java.polyglot/lib/
com.ibm.wala.cast.java.test.data/src/JLex/
com.ibm.wala.cast.java.test/testdata/
com.ibm.wala.cast.js.html.nu_validator/lib/
com.ibm.wala.cast.js.nodejs/lib/
com.ibm.wala.cast.js.rhino.test/*.dump
com.ibm.wala.cast.js.rhino.test/*.html*
com.ibm.wala.cast.js.rhino.test/2009_swine_flu_outbreak
com.ibm.wala.cast.js.rhino.test/?game*
com.ibm.wala.cast.js.rhino.test/BunnyHunt
com.ibm.wala.cast.js.rhino.test/digg_attack
com.ibm.wala.cast.js.rhino.test/game.php*
com.ibm.wala.cast.js.rhino.test/xxxx
com.ibm.wala.cast.js.rhino/lib/
com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
com.ibm.wala.cast.js.test/examples-src/ajaxslt/
com.ibm.wala.cast.js/lib/
com.ibm.wala.core.testdata/*.jar
com.ibm.wala.core.testdata/@dot/
com.ibm.wala.core.testdata/lib/
com.ibm.wala.core.testdata/ocaml/
com.ibm.wala.core.tests/dat/wala.examples.properties
com.ibm.wala.core.tests/report
com.ibm.wala.core/@dot
com.ibm.wala.core/com.ibm.wala.core*.jar
com.ibm.wala.core/dat/wala.properties
com.ibm.wala.dalvik/src/logback.xml
com.ibm.wala.ide.jdt.test/testdata/
edu.kit.wala.smali.test/out/
.project
/*/.settings/org.eclipse.buildship.core.prefs
/.gradle/
/.settings/org.eclipse.buildship.core.prefs
/.vscode/settings.json
/build/
/com.ibm.wala.*/out/
/com.ibm.wala.cast.java.jdt.test/
/com.ibm.wala.cast.java.polyglot/lib/
/com.ibm.wala.cast.java.test.data/src/JLex/
/com.ibm.wala.cast.java.test/testdata/
/com.ibm.wala.cast.js.html.nu_validator/lib/
/com.ibm.wala.cast.js.nodejs/lib/
/com.ibm.wala.cast.js.rhino.test/*.dump
/com.ibm.wala.cast.js.rhino.test/*.html*
/com.ibm.wala.cast.js.rhino.test/2009_swine_flu_outbreak
/com.ibm.wala.cast.js.rhino.test/?game*
/com.ibm.wala.cast.js.rhino.test/BunnyHunt
/com.ibm.wala.cast.js.rhino.test/digg_attack
/com.ibm.wala.cast.js.rhino.test/game.php*
/com.ibm.wala.cast.js.rhino.test/xxxx
/com.ibm.wala.cast.js.rhino/lib/
/com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
/com.ibm.wala.cast.js.test/examples-src/ajaxslt/
/com.ibm.wala.cast.js/lib/
/com.ibm.wala.cast/lib/
/com.ibm.wala.core.testdata/*.jar
/com.ibm.wala.core.testdata/@dot/
/com.ibm.wala.core.testdata/lib/
/com.ibm.wala.core.tests/report
/com.ibm.wala.core/@dot
/com.ibm.wala.core/com.ibm.wala.core*.jar
/com.ibm.wala.core/dat/wala.properties
/com.ibm.wala.dalvik.test/data/sample.cup
/com.ibm.wala.dalvik.test/parser.java
/com.ibm.wala.dalvik.test/report
/com.ibm.wala.dalvik.test/sym.java
/com.ibm.wala.ide.jdt.test/testdata/
/edu.kit.wala.smali.test/out/
results
target/
com.ibm.wala.dalvik.test/data/sample.cup
com.ibm.wala.dalvik.test/parser.java
com.ibm.wala.dalvik.test/report
com.ibm.wala.dalvik.test/sym.java
results

6
.idea/.gitignore vendored Normal file
View File

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

51
.idea/gradle.xml Normal file
View File

@ -0,0 +1,51 @@
<?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>

7
.idea/misc.xml Normal file
View File

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

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

6
.idea/vcs.xml Normal file
View File

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

View File

@ -1,26 +1,23 @@
language: android
jdk: oraclejdk8
sudo: false
android:
components:
- build-tools-26.0.2
addons:
apt:
packages:
- realpath
- xvfb
before_install:
- git clone --depth=1 https://github.com/secure-software-engineering/DroidBench.git /tmp/DroidBench
- export M2_HOME=$HOME/apache-maven-3.5.0
- if [ ! -d $M2_HOME/bin ]; then curl https://archive.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz | tar zxf - -C $HOME; fi
- export PATH=$M2_HOME/bin:$PATH
install:
- mvn clean verify -DskipTests=true -B -q
script:
- xvfb-run mvn clean install -B -q
- bash ./dependent-projects-trigger.sh $AUTH_TOKEN
- mvn javadoc:aggregate -B -q
- bash ./upload-javascript.sh $GH_TOKEN
- ./build-maven-jars.py "install -Dgpg.skip"
sudo: false
- set -e
- source "travis/before-install-$BUILD_SYSTEM"
install: source "travis/install-$BUILD_SYSTEM"
script: source "travis/script-$BUILD_SYSTEM"
before_cache: source "travis/before-cache-$BUILD_SYSTEM"
cache:
directories:
- "$HOME/.goomph"
- "$HOME/.gradle/caches"
- "$HOME/.gradle/wrapper"
- "$HOME/.m2"
- "$HOME/apache-maven-3.5.0"
- "$TRAVIS_BUILD_DIR/com.ibm.wala.core.testdata/ocaml/ocamljava-2.0-alpha1/lib"
@ -28,3 +25,297 @@ env:
global:
- secure: KcugjQYnBqeZ7XenZD5QY7jhekVPO0QpQyjDUteLytaokhyRK2g6eNvr/pPerN2uWUvsPwO18P9F+oOupge1cpPZf4cEY8RzLIromyUoRWd6JA0SKciUYdN2kSqnC4uZSJGXeGLoroyEEL4Q2sqimpkbIGxgxYtVniWgJULOyR4=
- secure: jacvGPYX4ugG/HgwJEEpWnllWsS/ipX+qRJ7qM5mbDYryeqsz0eiaxBxQ6IpDyj0v6O4DUi74lSQs/UxCWcUxvOn/5AweCZfoF1U8vt1xivanR4MbC2kr6rJ6ohICuJ4PHDS4IffncgaP3Y8cfExHq6+d0tbibYkjRIiMUGpSik=
matrix:
include:
- os: linux
env: BUILD_SYSTEM=gradle
language: java
jdk: oraclejdk8
- os: linux
env: BUILD_SYSTEM=maven
language: android
jdk: oraclejdk8
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle
language: java
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.ecj
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.test
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.test.data
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.html.nu_validator
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.nodejs
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.nodejs.test
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.rhino
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.rhino.test
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.test
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.test.data
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.test
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core.testdata
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core.tests
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.dalvik
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.dalvik.test
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jdt
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jdt.test
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jsdt
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jsdt.tests
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.tests
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.scandroid
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.shrike
language: java
jdk: oraclejdk8
if: type = cron
- os: linux
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.util
language: java
jdk: oraclejdk8
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.ecj
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.test
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.java.test.data
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.html.nu_validator
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.nodejs
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.nodejs.test
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.rhino
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.rhino.test
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.test
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.js.test.data
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.cast.test
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core.testdata
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.core.tests
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.dalvik
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.dalvik.test
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jdt
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jdt.test
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jsdt
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.jsdt.tests
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.ide.tests
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.scandroid
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.shrike
language: java
if: type = cron
- os: osx
osx_image: xcode8.3
env: BUILD_SYSTEM=gradle BUILD_ONLY_SUBMODULE=com.ibm.wala.util
language: java
if: type = cron

View File

@ -0,0 +1,19 @@
<?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 Normal file
View File

@ -0,0 +1,277 @@
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.

340
README-Gradle.md Normal file
View File

@ -0,0 +1,340 @@
This document describes some WALA-specific aspects of our new Gradle
build system, plus a few general Gradle features that may be of
particular interest to WALA developers. However, it is not a Gradle
tutorial.
# Pros and Cons of Switching to Gradle
## Selected Gradle Advantages in Brief
- [more comprehensive management of external
dependencies](#comprehensive-external-dependencies)
- faster builds using [parallel task
execution](https://docs.gradle.org/current/userguide/multi_project_builds.html#sec:parallel_execution)
and [user-scoped
caching](https://docs.gradle.org/current/userguide/build_cache.html)
(both enabled by default)
- [trustworthy dependencies for incremental
builds](#trustworthy-dependencies-for-incremental-builds)
- [composite builds](#composite-builds) for easier integration of WALA
into larger projects
- [automated Travis CI testing on macOS](#travis-ci-macos)
## Known Shortcomings
The Gradle build system is not yet ready to replace Maven, due to a
few [known shortcomings](https://github.com/liblit/WALA/milestone/1).
Paramount among these is that [Gradle WALA builds do not yet package
up Eclipse plug-ins / features in the proper
manner](https://github.com/liblit/WALA/issues/6). I have [poked at
this a
bit](https://github.com/liblit/WALA/tree/gradle-artifact-publishing),
but I simply do not understand Eclipse and/or OSGi well enough to get
the job done. I welcome help from anyone with the right knowledge!
Either Gradle or Maven can be used to build WALA from the command
line. However, it was not possible to extend this dual-build-system
support to Eclipse. Working with WALA in Eclipse *requires* [doing
things the Gradle way](#eclipse). Fortunately, this is rather
seamless; I see no reason why an Eclipse-using WALA developer should
need to avoid this switch.
As noted [below](#classpath-and-project-as-generated-files), Eclipse
`.classpath` and `.project` files are now generated rather than being
repository-tracked source files. However, a few Maven-run tests
depend on having certain of these files present. One way to create
them is to [import WALA into
Eclipse](#importing-wala-projects-into-eclipse) before starting your
Maven tests. If you prefer a non-interactive approach, you can
instead run `./gradlew prepareMavenBuild` before starting your Maven
tests.
# Getting Started
## External Dependencies: Patience is a Virtue
Gradle downloads many packages and supporting Java libraries as
needed. Your first Gradle build may take a long time. On a fast
workstation with a University-grade network and no local caches, my
initial run of `./gradlew assemble processTestResources` took five
minutes. On a decent laptop with residential DSL and no local caches,
the same initial build took twenty minutes. Fortunately, user- and
project-level Gradle caches will make incremental rebuilds much
faster. Rerunning `./gradlew assemble processTestResources` with a
warm cache in an already-built tree takes under three seconds.
Maven is the same, really. You may already have most of what Maven
needs downloaded and cached locally, but your first Maven WALA build
was probably slow as well. Recent Travis CI runs have showed Gradle
and Maven builds completing in fifteen to twenty minutes, without
significant variation between the two build systems.
<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

@ -29,14 +29,14 @@ projects = [
for proj in projects:
full_proj = "com.ibm.wala." + proj
print full_proj
print(full_proj)
os.chdir(full_proj)
mvnCmd = "mvn -f mvncentral.xml clean " + action
try:
subprocess.check_output(mvnCmd, shell=True)
except subprocess.CalledProcessError as e:
print "OUTPUT"
print e.output
print("OUTPUT")
print(e.output)
raise
os.chdir("..")

184
build.gradle Normal file
View File

@ -0,0 +1,184 @@
////////////////////////////////////////////////////////////////////////
//
// plugin configuration must precede everything else
//
plugins {
id 'com.diffplug.gradle.p2.asmaven' version '3.10.0'
id 'com.github.hauner.jarTest' version '1.0.1' apply false
id 'de.undercouch.download'
id 'nebula.lint' version '8.3.1'
id 'nebula.source-jar' version '7.0.1' apply false
}
////////////////////////////////////////////////////////////////////////
//
// required Eclipse components
//
p2AsMaven {
group 'eclipse-deps', {
repoEclipse '4.7.2'
slicingOption 'latestVersionOnly', 'true'
iu 'org.eclipse.core.commands'
iu 'org.eclipse.core.contenttype'
iu 'org.eclipse.core.jobs'
iu 'org.eclipse.core.resources'
iu 'org.eclipse.core.runtime'
iu 'org.eclipse.equinox.app'
iu 'org.eclipse.equinox.common'
iu 'org.eclipse.equinox.preferences'
iu 'org.eclipse.jdt.core'
iu 'org.eclipse.jface'
iu 'org.eclipse.osgi'
iu 'org.eclipse.pde.core'
iu 'org.eclipse.swt'
iu 'org.eclipse.ui.ide'
iu 'org.eclipse.ui.workbench'
}
group 'wst-deps', {
repo 'http://download.eclipse.org/releases/oxygen'
slicingOption 'latestVersionOnly', 'true'
iu 'org.eclipse.wst.jsdt.core'
iu 'org.eclipse.wst.jsdt.ui'
}
}
////////////////////////////////////////////////////////////////////////
//
// common Java setup shared by multiple projects
//
group name
version '1.5.1-SNAPSHOT-DASCA'
subprojects { subproject ->
// skip generic Java setup for the few projects that have no Java code whatsoever
switch (subproject.name) {
case 'com.ibm.wala-repository':
case ~/.*_feature/:
return
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'nebula.source-jar'
version rootProject.version
repositories {
mavenCentral()
maven {
url "$rootProject.buildDir/p2asmaven/maven"
}
}
jar.manifest.from('META-INF/MANIFEST.MF')
publishing.publications {
mavenJava(MavenPublication) {
from components.java
}
}
task afterEclipseBuildshipImport(dependsOn: processTestResources)
task prepareIntelliJIDEA
test {
include '**/*Test.class'
include '**/*TestCase.class'
include '**/*Tests.class'
include '**/Test*.class'
exclude '**/*AndroidLibs*.class'
maxParallelForks = Integer.MAX_VALUE
}
}
task afterEclipseBuildshipImport(type: Exec) {
commandLine './revert-launchers.sh'
}
////////////////////////////////////////////////////////////////////////
//
// find platform-specific SWT implementations
//
def osgi_platform
switch (System.getProperty('os.name')) {
case ~/Mac OS X/:
osgi_platform = 'cocoa.macosx.x86_64'
break
case ~/Windows.*/:
osgi_platform = 'win32.win32.x86_64'
break
case ~/Linux/:
osgi_platform = 'gtk.linux.x86_64'
break
}
System.setProperty('osgi.platform', osgi_platform)
subprojects {
configurations.all {
resolutionStrategy {
// failOnVersionConflict()
dependencySubstitution {
substitute module('eclipse-deps:org.eclipse.swt.${osgi.platform}') with module("eclipse-deps:org.eclipse.swt.${System.getProperty('osgi.platform')}:3.+")
}
}
}
}
////////////////////////////////////////////////////////////////////////
//
// optional lint checking of Gradle scripts
//
allprojects {
apply plugin: 'nebula.lint'
gradleLint.alwaysRun = false
gradleLint {
rules = ['all-dependency']
excludedRules = [
'duplicate-dependency-class',
'transitive-duplicate-dependency-class',
'unused-dependency',
]
}
}
////////////////////////////////////////////////////////////////////////
//
// disable Javadoc linter until documentation is in better shape
//
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
////////////////////////////////////////////////////////////////////////
//
// Eclipse IDE integration
//
// workaround for <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 Normal file
View File

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

7
buildSrc/build.gradle Normal file
View File

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

View File

@ -0,0 +1,31 @@
import org.gradle.api.tasks.*
////////////////////////////////////////////////////////////////////////
//
// create a Javadoc-style "package-list" file
//
@CacheableTask
class CreatePackageList extends org.gradle.api.DefaultTask {
@PathSensitive(PathSensitivity.RELATIVE)
@Input Object sourceSet
@OutputFile File packageList = new File("$temporaryDir/package-list")
@TaskAction
def create() {
sourceSet.sourceCollections.collect { collection ->
def sourceRoot = collection.tree.dir.toPath()
collection.collect { source ->
def javaSourceFilePath = source.toPath()
def parentPath = javaSourceFilePath.parent
def relativePath = sourceRoot.relativize(parentPath)
relativePath.toString().replace(File.separator, '.')
}
}.flatten().sort().unique().each {
packageList << "$it\n"
}
}
}

View File

@ -0,0 +1,53 @@
import org.gradle.api.tasks.*
////////////////////////////////////////////////////////////////////////
//
// download and use checksum to verify that we got what we expected
//
@CacheableTask
class VerifiedDownload extends org.gradle.api.DefaultTask {
// URL of resource to download
def @Input src
// expected checksum of resource as hex digits
def @Input checksum
// algorithm to use for computing checksum
def @Input algorithm = 'MD5'
// whether to use ETag for selective downloading
def @Input useETag = true
// local file into which resource should be saved
def @OutputFile dest
File getDest() {
return project.file(dest)
}
VerifiedDownload() {
outputs.upToDateWhen {
getDest().exists()
}
}
@TaskAction
downloadAndVerify() {
def destFile = getDest()
project.download {
src this.src
dest destFile
overwrite true
onlyIfModified true
useETag this.useETag
}
project.verifyChecksum {
src destFile
algorithm this.algorithm
checksum this.checksum
}
}
}

View File

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

View File

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

View File

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

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.java.ecj</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

@ -9,14 +9,19 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error
org.eclipse.jdt.core.compiler.problem.deprecation=warning
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

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.ecj
Bundle-Version: 1.4.4.qualifier
Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: com.ibm.wala.cast.java,

View File

@ -0,0 +1,15 @@
sourceSets.main.java.srcDirs = ['src']
dependencies {
compile(
'eclipse-deps:org.eclipse.core.runtime:+',
'eclipse-deps:org.eclipse.equinox.common:+',
'eclipse-deps:org.eclipse.jdt.core:+',
'org.osgi:org.osgi.core:4.2.0',
project(':com.ibm.wala.cast'),
project(':com.ibm.wala.cast.java'),
project(':com.ibm.wala.core'),
project(':com.ibm.wala.shrike'),
project(':com.ibm.wala.util'),
)
}

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast.java.ecj</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>WALA CAst Java ECJ</name>
<description>WALA Common AST Java ECJ front-end</description>
@ -45,27 +45,27 @@
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.util</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast.java</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.core</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.shrike</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
@ -106,8 +106,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

View File

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

View File

@ -52,8 +52,8 @@ public class SourceDirCallGraph {
AnalysisScope scope = new JavaSourceAnalysisScope();
// add standard libraries to scope
String[] stdlibs = WalaProperties.getJ2SEJarFiles();
for (int i = 0; i < stdlibs.length; i++) {
scope.addToScope(ClassLoaderReference.Primordial, new JarFile(stdlibs[i]));
for (String stdlib : stdlibs) {
scope.addToScope(ClassLoaderReference.Primordial, new JarFile(stdlib));
}
// add the source directory
scope.addToScope(JavaSourceAnalysisScope.SOURCE, new SourceDirectoryTreeModule(new File(sourceDir)));

View File

@ -174,7 +174,6 @@ public class JDT2CAstUtils {
* Returns true if type is char, byte, short, int, or long. Return false otherwise (including boolean!)
*
* @param type
* @return
*/
public static boolean isLongOrLess(ITypeBinding type) {
String t = type.getBinaryName();
@ -186,11 +185,10 @@ public class JDT2CAstUtils {
* CAstSymbol.NULL_DEFAULT_VALUE.
*
* @param type
* @return
*/
public static Object defaultValueForType(ITypeBinding type) {
if (isLongOrLess(type))
return new Integer(0);
return Integer.valueOf(0);
else if (type.getBinaryName().equals("D") || type.getBinaryName().equals("F"))
return new Double(0.0);
else
@ -237,7 +235,6 @@ public class JDT2CAstUtils {
*
* @param returnType
* @param ast
* @return
*/
public static ITypeBinding getErasedType(ITypeBinding returnType, AST ast) {
if (returnType.isTypeVariable() || returnType.isCapture())

View File

@ -42,7 +42,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@ -254,8 +253,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
List<CAstEntity> declEntities = new ArrayList<>();
for (Iterator<CAstEntity> iter = cu.types().iterator(); iter.hasNext();) {
AbstractTypeDeclaration decl = (AbstractTypeDeclaration) iter.next();
for (AbstractTypeDeclaration decl : (Iterable<AbstractTypeDeclaration>) cu.types()) {
// can be of type AnnotationTypeDeclaration, EnumDeclaration, TypeDeclaration
declEntities.add(visit(decl, new RootContext()));
}
@ -276,7 +274,12 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
protected final class ClassEntity implements CAstEntity {
// TAGALONG (not static, will keep reference to ast, fIdentityMapper, etc)
private final String fName;
@Override
public Position getPosition(int arg) {
return null;
}
private final String fName;
private final Collection<CAstQualifier> fQuals;
@ -286,8 +289,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private final T fSourcePosition;
private final T fNamePos;
public ClassEntity(ITypeBinding jdtType, String name, Collection<CAstQualifier> quals, Collection<CAstEntity> entities,
T pos) {
T pos, T namePos) {
fNamePos = namePos;
fName = name;
fQuals = quals;
fEntities = entities;
@ -393,6 +399,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
return fTypeDict.new JdtJavaType(fJdtType);
}
@Override
public Position getNamePosition() {
return fNamePos;
}
}
private static boolean isInterface(AbstractTypeDeclaration decl) {
@ -402,7 +413,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private CAstEntity visitTypeDecl(AbstractTypeDeclaration n, WalkContext context) {
return createClassDeclaration(n, n.bodyDeclarations(), null, n.resolveBinding(), n.getName().getIdentifier(), n.getModifiers(),
isInterface(n), n instanceof AnnotationTypeDeclaration, context);
isInterface(n), n instanceof AnnotationTypeDeclaration, context, makePosition(n.getName()));
}
/**
@ -413,11 +424,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* @param typeBinding
* @param name Used in creating default constructor, and passed into new ClassEntity()
* @param context
* @return
* @param namePos
*/
private CAstEntity createClassDeclaration(ASTNode n, List<BodyDeclaration> bodyDecls,
List<EnumConstantDeclaration> enumConstants, ITypeBinding typeBinding, String name, int modifiers,
boolean isInterface, boolean isAnnotation, WalkContext context) {
boolean isInterface, boolean isAnnotation, WalkContext context, T namePos) {
final List<CAstEntity> memberEntities = new ArrayList<>();
// find and collect all initializers (type Initializer) and field initializers (type VariableDeclarationFragment).
@ -427,13 +438,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
ArrayList<ASTNode> staticInits = new ArrayList<>();
if (enumConstants != null) {
for (Object decl : enumConstants) {
EnumConstantDeclaration ecd = (EnumConstantDeclaration) decl;
staticInits.add(ecd); // always (implicitly) static,final (actually, no modifiers allowed)
}
// always (implicitly) static,final (actually, no modifiers allowed)
staticInits.addAll(enumConstants);
}
for (Object decl : bodyDecls) {
for (BodyDeclaration decl : bodyDecls) {
if (decl instanceof Initializer) {
Initializer initializer = (Initializer) decl;
boolean isStatic = ((initializer.getModifiers() & Modifier.STATIC) != 0);
@ -441,8 +450,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
} else if (decl instanceof FieldDeclaration) {
FieldDeclaration fd = (FieldDeclaration) decl;
for (Object f : fd.fragments()) {
VariableDeclarationFragment frag = (VariableDeclarationFragment) f;
for (VariableDeclarationFragment frag : (Iterable<VariableDeclarationFragment>) fd.fragments()) {
if (frag.getInitializer() != null) {
boolean isStatic = ((fd.getModifiers() & Modifier.STATIC) != 0);
(isStatic ? staticInits : inits).add(frag);
@ -453,22 +461,20 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
// process entities. initializers will be folded in here.
if (enumConstants != null) {
for (Object decl : enumConstants) {
memberEntities.add(visit((EnumConstantDeclaration) decl, context));
for (EnumConstantDeclaration decl : enumConstants) {
memberEntities.add(visit(decl, context));
}
}
for (Object d : bodyDecls) {
BodyDeclaration decl = (BodyDeclaration) d;
for (BodyDeclaration decl : bodyDecls) {
if (decl instanceof FieldDeclaration) {
FieldDeclaration fieldDecl = (FieldDeclaration) decl;
Collection<CAstQualifier> quals = JDT2CAstUtils.mapModifiersToQualifiers(fieldDecl.getModifiers(), false, false);
for (Object f : fieldDecl.fragments()) {
VariableDeclarationFragment fieldFrag = (VariableDeclarationFragment) f;
for (VariableDeclarationFragment fieldFrag : (Iterable<VariableDeclarationFragment>) fieldDecl.fragments()) {
IVariableBinding fieldBinding = fieldFrag.resolveBinding();
memberEntities.add(new FieldEntity(fieldFrag.getName().getIdentifier(), fieldBinding.getType(), quals,
makePosition(fieldFrag.getStartPosition(), fieldFrag.getStartPosition() + fieldFrag.getLength()),
handleAnnotations(fieldBinding)));
handleAnnotations(fieldBinding), makePosition(fieldFrag.getName())));
}
} else if (decl instanceof Initializer) {
// Initializers are inserted into constructors when making constructors.
@ -500,8 +506,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
// add default constructor(s) if necessary
// most default constructors have no parameters; however, those created by anonymous classes will have parameters
// (they just call super with those parameters)
for (Object m : typeBinding.getDeclaredMethods()) {
IMethodBinding met = (IMethodBinding) m;
for (IMethodBinding met : typeBinding.getDeclaredMethods()) {
if (met.isDefaultConstructor()) {
if (typeBinding.isEnum())
memberEntities.add(createEnumConstructorWithParameters(met, n, context, inits, null));
@ -530,12 +535,12 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
Collection<CAstQualifier> quals = JDT2CAstUtils.mapModifiersToQualifiers(modifiers, isInterface, isAnnotation);
return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n));
return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n), namePos);
}
private CAstEntity visit(AnonymousClassDeclaration n, WalkContext context) {
return createClassDeclaration(n, n.bodyDeclarations(), null, n.resolveBinding(),
JDT2CAstUtils.anonTypeName(n.resolveBinding()), 0 /* no modifiers */, false, false, context);
JDT2CAstUtils.anonTypeName(n.resolveBinding()), 0 /* no modifiers */, false, false, context, null);
}
private CAstNode visit(TypeDeclarationStatement n, WalkContext context) {
@ -657,7 +662,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* constructor.
* @param context
* @param inits
* @return
*/
private CAstNode createConstructorBody(MethodDeclaration n, ITypeBinding classBinding, WalkContext context,
ArrayList<ASTNode> inits) {
@ -729,7 +733,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* @param overriding Declaration of the overriding method.
* @param overridden Binding of the overridden method, in a a superclass or implemented interface.
* @param oldContext
* @return
*/
private CAstEntity makeSyntheticCovariantRedirect(MethodDeclaration overriding, IMethodBinding overridingBinding,
IMethodBinding overridden, WalkContext oldContext) {
@ -751,8 +754,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
ArrayList<CAstNode> arguments = new ArrayList<>();
int i = 0;
for (Object o : overriding.parameters()) {
SingleVariableDeclaration svd = (SingleVariableDeclaration) o;
for (SingleVariableDeclaration svd : (Iterable<SingleVariableDeclaration>) overriding.parameters()) {
CAstNode varNode = makeNode(context, fFactory, null, CAstNode.VAR, fFactory.makeConstant(svd.getName().getIdentifier()));
ITypeBinding fromType = JDT2CAstUtils.getErasedType(paramTypes[i], ast);
ITypeBinding toType = JDT2CAstUtils.getErasedType(overridingBinding.getParameterTypes()[i], ast);
@ -941,16 +943,16 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
if (parameterTypes == null) {
fParameterTypes = new ArrayList<>(fDecl.parameters().size());
for (Object p : fDecl.parameters()) {
fParameterNames[i++] = ((SingleVariableDeclaration) p).getName().getIdentifier();
fParameterTypes.add(fTypeDict.getCAstTypeFor(((SingleVariableDeclaration) p).resolveBinding().getType()));
for (SingleVariableDeclaration p : (Iterable<SingleVariableDeclaration>) fDecl.parameters()) {
fParameterNames[i++] = p.getName().getIdentifier();
fParameterTypes.add(fTypeDict.getCAstTypeFor(p.resolveBinding().getType()));
}
} else {
// currently this is only used in making a default constructor with arguments (anonymous classes).
// this is because we cannot synthesize bindings.
fParameterTypes = parameterTypes;
for (Object p : fDecl.parameters()) {
fParameterNames[i++] = ((SingleVariableDeclaration) p).getName().getIdentifier();
for (SingleVariableDeclaration p : (Iterable<SingleVariableDeclaration>) fDecl.parameters()) {
fParameterNames[i++] = p.getName().getIdentifier();
}
}
} else {
@ -1043,8 +1045,13 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
return new CAstType.Method() {
private Collection<CAstType> fExceptionTypes = null;
@Override
@SuppressWarnings("deprecation")
public boolean isStatic() {
return getQualifiers().contains(CAstQualifier.STATIC);
}
@Override
public CAstType getReturnType() {
if (fReturnType != null)
return fTypeDict.getCAstTypeFor(fReturnType);
@ -1088,9 +1095,9 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
if (fExceptionTypes == null) {
fExceptionTypes = new LinkedHashSet<>();
if (fDecl != null)
for (Object exception : fDecl.thrownExceptionTypes())
for (SimpleType exception : (Iterable<SimpleType>) fDecl.thrownExceptionTypes())
fExceptionTypes.add(fTypeDict.getCAstTypeFor(((SimpleType) exception).resolveBinding()));
fExceptionTypes.add(fTypeDict.getCAstTypeFor(exception.resolveBinding()));
}
return fExceptionTypes;
}
@ -1101,6 +1108,22 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
}
};
}
@Override
public Position getPosition(int arg) {
// TODO Auto-generated method stub
SingleVariableDeclaration p = (SingleVariableDeclaration) fDecl.parameters().get(arg);
return makePosition(p);
}
@Override
public Position getNamePosition() {
if (fDecl == null) {
return null;
} else {
return makePosition(fDecl);
}
}
}
// ////////////////////////////////////
@ -1153,13 +1176,16 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private final T position;
private final T namePos;
private final Set<CAstAnnotation> annotations;
private FieldEntity(String name, ITypeBinding type, Collection<CAstQualifier> quals, T position, Set<CAstAnnotation> annotations) {
private FieldEntity(String name, ITypeBinding type, Collection<CAstQualifier> quals, T position, Set<CAstAnnotation> annotations, T namePos) {
super();
this.type = type;
this.quals = quals;
this.name = name;
this.namePos = namePos;
this.position = position;
this.annotations = annotations;
}
@ -1252,6 +1278,19 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
public CAstType getType() {
return fTypeDict.getCAstTypeFor(type);
}
@Override
public Position getPosition(int arg) {
return namePos;
}
@Override
public Position getNamePosition() {
// TODO Auto-generated method stub
return null;
}
}
// /////////////////////////////////////
@ -1264,8 +1303,8 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*/
private ArrayList<CAstNode> createBlock(Block n, WalkContext context) {
ArrayList<CAstNode> stmtNodes = new ArrayList<>();
for (Object s : n.statements())
visitNodeOrNodes((ASTNode) s, context, stmtNodes);
for (ASTNode s : (Iterable<ASTNode>) n.statements())
visitNodeOrNodes(s, context, stmtNodes);
return stmtNodes;
}
@ -1311,8 +1350,8 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private ArrayList<CAstNode> visit(VariableDeclarationStatement n, WalkContext context) {
ArrayList<CAstNode> result = new ArrayList<>();
for (Object o : n.fragments())
result.add(visit((VariableDeclarationFragment) o, context));
for (VariableDeclarationFragment o : (Iterable<VariableDeclarationFragment>) n.fragments())
result.add(visit(o, context));
return result;
}
@ -1325,11 +1364,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
eltNodes[idx++] = makeNode(context, fFactory, n, CAstNode.NEW, fFactory.makeConstant(newTypeRef), fFactory.makeConstant(n
.expressions().size()));
for (Iterator<CAstEntity> iter = n.expressions().iterator(); iter.hasNext(); idx++) {
Expression element = (Expression) iter.next();
for (Expression element : (Iterable<Expression>) n.expressions()) {
eltNodes[idx] = visitNode(element, context);
if (eltNodes[idx] == null)
assert eltNodes[idx] != null : element.toString();
++idx;
}
return makeNode(context, fFactory, n, CAstNode.ARRAY_LITERAL, eltNodes);
@ -1412,8 +1451,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
argNodes[idx++] = fFactory.makeConstant(callSiteRef);
// rest of args
for (Iterator<?> iter = arguments.iterator(); iter.hasNext();) {
Object arg = iter.next();
for (Object arg : arguments) {
argNodes[idx++] = (arg instanceof CAstNode) ? ((CAstNode) arg) : visitNode((Expression) arg, context);
}
callNode = makeNode(context, fFactory, nn, CAstNode.CALL, argNodes);
@ -1676,7 +1714,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* the code into an assignment and binary operation.
*
* @param context
* @return
*/
private CAstNode doFunkyGenericAssignPreOpHack(Assignment assign, WalkContext context) {
Expression left = assign.getLeftHandSide();
@ -1762,7 +1799,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*
* @param n
* @param context
* @return
*/
private CAstNode visit(SimpleName n, WalkContext context) {
// class name, handled above in either method invocation, qualified name, or qualified this
@ -1829,7 +1865,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*
* @param typeOfThis
* @param isPrivate
* @return
*/
private static ITypeBinding findClosestEnclosingClassSubclassOf(ITypeBinding typeOfThis, ITypeBinding owningType, boolean isPrivate) {
// GENERICS
@ -1877,7 +1912,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*
* @param n
* @param context
* @return
*/
private CAstNode visit(FieldAccess n, WalkContext context) {
CAstNode targetNode = visitNode(n.getExpression(), context);
@ -1894,7 +1928,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* @param fieldName Name of the field.
* @param positioningNode Used only for making a JdtPosition.
* @param context
* @return
*/
private CAstNode createFieldAccess(CAstNode targetNode, String fieldName, IVariableBinding possiblyParameterizedBinding,
ASTNode positioningNode, WalkContext context) {
@ -1989,7 +2022,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*
* @param n
* @param context
* @return
*/
private CAstNode visit(QualifiedName n, WalkContext context) {
// "package.Class" is a QualifiedName, but also is "Class.staticField"
@ -2022,8 +2054,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
// keep on adding operands on the right side
leftLength = n.getRightOperand().getStartPosition() + n.getRightOperand().getLength() - leftStartPosition;
for (Object o : n.extendedOperands()) {
Expression operand = (Expression) o;
for (Expression operand : (Iterable<Expression>) n.extendedOperands()) {
result = createInfixExpression(n.getOperator(), leftType, leftStartPosition, leftLength, result, operand, context);
if (leftType.isPrimitive() && operand.resolveTypeBinding().isPrimitive())
@ -2326,7 +2357,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private CAstNode getSwitchCaseConstant(SwitchCase n, WalkContext context) {
// TODO: enums
Expression expr = n.getExpression();
Object constant = (expr == null) ? new Integer(0) : expr.resolveConstantExpressionValue(); // default case label of
Object constant = (expr == null) ? Integer.valueOf(0) : expr.resolveConstantExpressionValue(); // default case label of
// "0" (what polyglot
// does). we also set
// SWITCH_DEFAULT
@ -2390,8 +2421,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
ArrayList<CAstNode> currentBlock = new ArrayList<>();
// Now produce the CAst representation for each case
for (Object o : cases) {
Statement s = (Statement) o;
for (Statement s : cases) {
if (s instanceof SwitchCase) {
if (!currentBlock.isEmpty()) {
// bundle up statements before this case
@ -2451,12 +2481,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/**
* Expands the form: for ( [final] Type var: iterable ) { ... } Into something equivalent to: for ( Iterator iter =
* iterable.iter(); iter.hasNext(); ) { [final] Type var = (Type) iter.next(); ... } Or, in the case of an array: for ( int idx =
* 0; i < iterable.length; i++ ) { [final] Type var = iterable[idx]; ... } Except that the expression "iterable" is only evaluate
* 0; i &lt; iterable.length; i++ ) { [final] Type var = iterable[idx]; ... } Except that the expression "iterable" is only evaluate
* once (or is it?)
*
* @param n
* @param context
* @return
*/
private CAstNode visit(EnhancedForStatement n, WalkContext context) {
if (n.getExpression().resolveTypeBinding().isArray())
@ -2585,7 +2614,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/*------ indexDecl --------- int tmpindex = 0 ------*/
final String tmpIndexName = "for temp index";
CAstNode indexDeclNode = makeNode(context, fFactory, n, CAstNode.DECL_STMT, fFactory.makeConstant(new InternalCAstSymbol(
tmpIndexName, fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("int")), true)), fFactory.makeConstant(new Integer(0)));
tmpIndexName, fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("int")), true)), fFactory.makeConstant(Integer.valueOf(0)));
/*------ cond ------------- tmpindex < tmparray.length ------*/
CAstNode tmpArrayLengthNode = makeNode(context, fFactory, n, CAstNode.ARRAY_LENGTH, makeNode(context, fFactory, n,
@ -2637,8 +2666,8 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
for (int i = 0; i < n.initializers().size(); i++) {
ASTNode init = (ASTNode) n.initializers().get(i);
if (init instanceof VariableDeclarationExpression) {
for (Object o : ((VariableDeclarationExpression) init).fragments())
inits.add(visitNode((ASTNode) o, context));
for (ASTNode o : (Iterable<ASTNode>) ((VariableDeclarationExpression) init).fragments())
inits.add(visitNode(o, context));
} else
inits.add(visitNode(init, context));
}
@ -2804,7 +2833,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* Giant switch statement.
*
* @param n
* @return
*/
private CAstEntity visit(AbstractTypeDeclaration n, WalkContext context) {
// handling of compilationunit in translate()
@ -2824,7 +2852,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* Giant switch statement, part deux
*
* @param context
* @return
*/
private CAstNode visitNode(ASTNode n, WalkContext context) {
if (n == null)
@ -3041,6 +3068,16 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
Assertions.UNREACHABLE("CompilationUnitEntity.getType()");
return null;
}
@Override
public Position getPosition(int arg) {
return null;
}
@Override
public Position getNamePosition() {
return null;
}
}
// /////////////////////////////
@ -3128,8 +3165,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
TryCatchContext(WalkContext parent, TryStatement tryNode) {
super(parent);
for (Iterator<CatchClause> catchIter = tryNode.catchClauses().iterator(); catchIter.hasNext();) {
CatchClause c = catchIter.next();
for (CatchClause c : (Iterable<CatchClause>) tryNode.catchClauses()) {
Pair<ITypeBinding, Object> p = Pair.make(c.getException().resolveBinding().getType(), (Object) c);
fCatchNodes.add(p);
@ -3334,11 +3370,10 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*
* @param decl
* @param context
* @return
*/
private CAstEntity visit(EnumConstantDeclaration decl, WalkContext context) {
return new FieldEntity(decl.getName().getIdentifier(), decl.resolveVariable().getType(), enumQuals, makePosition(decl
.getStartPosition(), decl.getStartPosition() + decl.getLength()), null);
.getStartPosition(), decl.getStartPosition() + decl.getLength()), null, makePosition(decl.getName()));
}
/**
@ -3477,12 +3512,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
constants.add(var);
// constants are unsorted by default
Collections.sort(constants, new Comparator<IVariableBinding>() {
@Override
public int compare(IVariableBinding arg0, IVariableBinding arg1) {
return arg0.getVariableId() - arg1.getVariableId();
}
});
Collections.sort(constants, (arg0, arg1) -> arg0.getVariableId() - arg1.getVariableId());
// PART II: create values()
memberEntities.add(createEnumValuesMethod(typeBinding, constants, context));
@ -3492,10 +3522,9 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
}
private CAstEntity visit(EnumDeclaration n, WalkContext context) {
// JDT contains correct type info / class / subclass info for the enum
return createClassDeclaration(n, n.bodyDeclarations(), n.enumConstants(), n.resolveBinding(), n.getName().getIdentifier(), n
.resolveBinding().getModifiers(), false, false, context);
.resolveBinding().getModifiers(), false, false, context, makePosition(n.getName()));
}
/**

View File

@ -51,7 +51,7 @@ import com.ibm.wala.cast.tree.CAstType;
import com.ibm.wala.cast.tree.impl.CAstTypeDictionaryImpl;
import com.ibm.wala.util.debug.Assertions;
public class JDTTypeDictionary extends CAstTypeDictionaryImpl {
public class JDTTypeDictionary extends CAstTypeDictionaryImpl<ITypeBinding> {
// TODO: better way of getting type "ObjecT" that doesn't require us to keep AST? although this is similar to
// polyglot.
@ -88,7 +88,7 @@ public class JDTTypeDictionary extends CAstTypeDictionaryImpl {
type = new JdtJavaArrayType(jdtType);
} else
Assertions.UNREACHABLE("getCAstTypeFor() passed type that is not primitive, array, or class?");
super.map(astType, type); // put in cache
super.map((ITypeBinding)astType, type); // put in cache
}
return type;
}

View File

@ -42,7 +42,6 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@ -136,9 +135,7 @@ public class ECJSourceModuleTranslator implements SourceModuleTranslator {
while (cl != null) {
List<Module> modules = scope.getModules(cl);
for (Iterator<Module> iter = modules.iterator(); iter.hasNext();) {
Module m = iter.next();
for (Module m : modules) {
if (m instanceof JarFileModule) {
JarFileModule jarFileModule = (JarFileModule) m;

View File

@ -1,7 +0,0 @@
<?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.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,103 +0,0 @@
/p
/A.class
/AnonymousClass.class
/AnonymousClass.java
/AnonymousClass$1.class
/AnonymousClass$1FooImpl.class
/AnonymousClass$2.class
/AnonymousClass$Foo.class
/Array1.class
/Array1.java
/ArrayLiteral1.class
/ArrayLiteral1.java
/ArrayLiteral2.class
/ArrayLiteral2.java
/B.class
/BadLanguageExceptionEx1.class
/BadLanguageExceptionF1.class
/Bar.class
/Base.class
/Breaks.class
/Breaks.java
/Breaks$1.class
/Breaks$Ref.class
/CastFromNull.class
/CastFromNull.java
/Casts.class
/Casts.java
/Derived.class
/Exception1.class
/Exception1.java
/Exception2.class
/Exception2.java
/Finally1.class
/Finally1.java
/FooEx1.class
/FooEx2.class
/FooF1.class
/FooIT1.class
/FooQ.class
/IFoo.class
/Inheritance1.class
/Inheritance1.java
/InheritedField.class
/InheritedField.java
/InnerClass.class
/InnerClass.java
/InnerClass$WhatsIt.class
/InnerClass$WhatsIt$NotAgain.class
/InnerClass$WhatsThat.class
/InnerClassA.class
/InnerClassA.java
/InnerClassA$AA.class
/InnerClassA$AB.class
/InnerClassA$AB$ABA.class
/InnerClassA$AB$ABA$ABAA.class
/InnerClassA$AB$ABA$ABAB.class
/InnerClassA$AB$ABSubA.class
/InnerClassA$AB$ABSubA$ABSubAA.class
/InnerClassSuper.class
/InnerClassSuper.java
/InnerClassSuper$SuperOuter.class
/InterfaceTest1.class
/InterfaceTest1.java
/IntWrapper.class
/LocalClass.class
/LocalClass.java
/LocalClass$1Foo.class
/LocalClass$2Foo.class
/MiniaturList.class
/MiniaturList.java
/MiniaturSliceBug.class
/MiniaturSliceBug.java
/Monitor.class
/Monitor.java
/NullArrayInit.class
/NullArrayInit.java
/PrimitiveWrapper.class
/QualifiedStatic.class
/QualifiedStatic.java
/R.class
/Scoping1.class
/Scoping1.java
/Scoping2.class
/Scoping2.java
/Scoping2$1.class
/Simple1.class
/Simple1.java
/StaticInitializers.class
/StaticInitializers.java
/StaticInitializers$X.class
/StaticNesting.class
/StaticNesting.java
/StaticNesting$WhatsIt.class
/Sub.class
/Sub$SubInner.class
/Switch1.class
/Switch1.java
/Thread1.class
/Thread1.java
/TwoClasses.class
/TwoClasses.java
/WhileTest1.class
/WhileTest1.java

View File

@ -1,38 +0,0 @@
<?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

@ -18,6 +18,7 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@ -68,7 +69,7 @@ org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
@ -80,7 +81,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
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=ignore
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=ignore
@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore

View File

@ -2,6 +2,6 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.test.data
Bundle-Version: 1.4.4.qualifier
Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8

View File

@ -0,0 +1,35 @@
plugins {
id 'eclipse'
}
sourceSets.test.java.srcDirs = ['src']
////////////////////////////////////////////////////////////////////////
//
// download JLex
//
task downloadJLex(type: VerifiedDownload) {
src 'http://www.cs.princeton.edu/~appel/modern/java/JLex/current/Main.java'
checksum 'fe0cff5db3e2f0f5d67a153cf6c783af'
dest 'src/JLex/Main.java'
}
task cleanDownloadJLex(type: Delete) {
delete downloadJLex.dest.parent
}
compileTestJava.dependsOn downloadJLex
clean.dependsOn cleanDownloadJLex
////////////////////////////////////////////////////////////////////////
//
// create Eclipse metadata for use by Maven when running
// com.ibm.wala.cast.java.test.JDTJavaIRTests and
// com.ibm.wala.cast.java.test.JDTJava15IRTests tests
//
task prepareMavenBuild(dependsOn: [eclipseClasspath, eclipseProject]) {
}

View File

@ -13,8 +13,8 @@
<property name="javacVerbose" value="false"/>
<property name="logExtension" value=".log"/>
<property name="compilerArg" value=""/>
<property name="javacSource" value="1.7"/>
<property name="javacTarget" value="1.7"/>
<property name="javacSource" value="1.8"/>
<property name="javacTarget" value="1.8"/>
<!-- 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.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.java.test.data</artifactId>
<packaging>eclipse-plugin</packaging>

View File

@ -15,7 +15,7 @@ public class AnonymousClass {
}
public static void main(String[] args) {
final Integer base = new Integer(6);
final Integer base = Integer.valueOf(6);
Foo f= new Foo() {
int value = 3;
@ -34,7 +34,7 @@ public class AnonymousClass {
}
public void method() {
final Integer base = new Integer(7);
final Integer base = Integer.valueOf(7);
abstract class FooImpl implements Foo {
int y;

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

View File

@ -10,7 +10,7 @@
*****************************************************************************/
public class LocalClass {
public static void main(String[] args) {
final Integer base = new Integer(6);
final Integer base = Integer.valueOf(6);
class Foo {
int value;
@ -27,7 +27,7 @@ public class LocalClass {
}
public void method() {
final Integer base = new Integer(6);
final Integer base = Integer.valueOf(6);
class Foo {
int value;

View File

@ -42,7 +42,6 @@ public class ArraysAndSuch {
public static void main(String args[]) {
ArraysAndSuch.main();
}
@SuppressWarnings("null")
public static void main() {
Object o1 = null;
Object[] os1 = new Object[] { null, o1, null };

View File

@ -42,7 +42,7 @@ import java.util.Iterator;
public class BasicsGenerics {
static ArrayList<String> strs = new ArrayList<String>();
static ArrayList<String> strs = new ArrayList<>();
static ArrayList<Integer> ints = new ArrayList<>();
public BasicsGenerics() {
@ -64,7 +64,7 @@ public class BasicsGenerics {
System.out.println(frenchy);
System.out.println(sicilian);
strs.add("hello");
ints.add(new Integer(3));
ints.add(Integer.valueOf(3));
String qqq;

View File

@ -95,7 +95,7 @@ class MyGeneric<A extends Object, B extends IGeneric<A>> {
}
public class CustomGenericsAndFields {
static ConcreteGeneric2<String> cg2 = new ConcreteGeneric2<String>();
static ConcreteGeneric2<String> cg2 = new ConcreteGeneric2<>();
static public ConcreteGeneric2<String> cg2WithSideEffects() {
System.out.println("look at me! I'm a side effect!");
@ -109,7 +109,7 @@ public class CustomGenericsAndFields {
private void doit() {
// Simple: concrete generic
ConcreteGeneric<String> absinthe = new ConcreteGeneric<String>();
ConcreteGeneric<String> absinthe = new ConcreteGeneric<>();
IGeneric<String> rye = absinthe;
String foo = rye.bar("hello", "world");
System.out.println(absinthe.foo() + foo);
@ -118,7 +118,7 @@ public class CustomGenericsAndFields {
String thrownaway = cg2.bar("a","b");
cg2.setFoo("real one");
MyGeneric<String,ConcreteGeneric2<String>> mygeneric = new MyGeneric<String,ConcreteGeneric2<String>>("useless",cg2);
MyGeneric<String,ConcreteGeneric2<String>> mygeneric = new MyGeneric<>("useless",cg2);
String x = mygeneric.doFoo();
System.out.println(x);
String y = cg2.x;

View File

@ -47,8 +47,8 @@ public class ExplicitBoxingTest {
int a = 6;
a = a + a;
System.out.println(a);
Integer useless1 = new Integer(5+6);
Integer aa = new Integer(a+a);
Integer useless1 = Integer.valueOf(5+6);
Integer aa = Integer.valueOf(a+a);
int aaa = aa.intValue();
System.out.println(aaa);

View File

@ -49,8 +49,8 @@ public class GenericArrays {
List<?>[] lsa = new List<?>[10]; // ok, array of unbounded wildcard type
Object o = lsa;
Object[] oa = (Object[]) o;
List<Integer> li = new ArrayList<Integer>();
li.add(new Integer(3));
List<Integer> li = new ArrayList<>();
li.add(Integer.valueOf(3));
oa[1] = li; // correct
String s = (String) lsa[1].get(0); // run time error, but cast is explicit

View File

@ -64,7 +64,7 @@ public class GenericMemberClasses<T>
}
}
public static void main(String args[]) {
(new GenericMemberClasses<Object>()).doit();
(new GenericMemberClasses<>()).doit();
}
private void doit() {

View File

@ -47,14 +47,14 @@ public class GenericSuperSink {
private void doit() {
Collection<? super String> sink;
Collection<String> cs = new ArrayList<String>();
Collection<String> cs = new ArrayList<>();
cs.add("hello");
sink = new ArrayList<Object>();
sink.add(cs.iterator().next());
System.out.println(sink);
sink = new ArrayList<String>();
sink = new ArrayList<>();
sink.add(cs.iterator().next());
System.out.println(sink);
}

View File

@ -55,7 +55,7 @@ public class MethodGenerics {
}
private void doit() {
ArrayList<String> list = new ArrayList<String>();
ArrayList<String> list = new ArrayList<>();
String array[] = new String[] { "coucou monde", "ciao mondo", "guten tag welt", "hola mundo", "shalom olam" };
fromArrayToCollection(array, list);
System.out.println(list);

View File

@ -58,7 +58,7 @@ public class MoreOverriddenGenerics {
@Override
public Long get() {
return new Long(6);
return Long.valueOf(6);
}
}

View File

@ -46,7 +46,7 @@ public class OverridesOnePointFour {
@Override
public Long get() {
return new Long(6);
return Long.valueOf(6);
}
}

View File

@ -64,16 +64,16 @@ public class Wildcards {
}
private void doit() {
ArrayList<String> e = new ArrayList<String>();
ArrayList<String> e = new ArrayList<>();
e.add("hello");
e.add("goodbye");
printCollection(e);
printCollection1(e);
printCollection2(e);
ArrayList<Integer> e3 = new ArrayList<Integer>();
e3.add(new Integer(123));
e3.add(new Integer(42));
ArrayList<Integer> e3 = new ArrayList<>();
e3.add(Integer.valueOf(123));
e3.add(Integer.valueOf(42));
printCollection(e3);
printCollection1(e3);

View File

@ -1,7 +0,0 @@
<?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.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,2 +0,0 @@
bin
domo-trace.txt*

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.java.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

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.test
Bundle-Version: 1.4.4.qualifier
Bundle-Version: 1.5.1.qualifier
Bundle-Activator: com.ibm.wala.cast.java.test.TestPlugin
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.core.tests,

View File

@ -0,0 +1,25 @@
plugins {
id 'com.github.hauner.jarTest'
id 'eclipse'
}
eclipse.project.natures 'org.eclipse.pde.PluginNature'
sourceSets.test.java.srcDirs = ['src']
dependencies {
testCompile(
'junit:junit:4.12',
'org.osgi:org.osgi.core:4.2.0',
project(':com.ibm.wala.cast'),
project(':com.ibm.wala.cast.java'),
project(':com.ibm.wala.core'),
project(':com.ibm.wala.shrike'),
project(':com.ibm.wala.util'),
project(configuration: 'testArchives', path: ':com.ibm.wala.core.tests'),
)
}
test {
maxHeapSize = '800M'
}

View File

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

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.wala</groupId>
<artifactId>WALA</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.java.test</artifactId>
<packaging>eclipse-plugin</packaging>
@ -35,7 +35,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -40,6 +40,7 @@ import com.ibm.wala.classLoader.SourceFileModule;
import com.ibm.wala.client.AbstractAnalysisEngine;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.cha.IClassHierarchy;
@ -53,6 +54,7 @@ import com.ibm.wala.types.TypeReference;
import com.ibm.wala.types.annotations.Annotation;
import com.ibm.wala.util.CancelException;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.collections.Iterator2Iterable;
import com.ibm.wala.util.collections.Pair;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.strings.Atom;
@ -190,9 +192,7 @@ public abstract class IRTests {
CGNode tgtNode = tgtNodes.iterator().next();
boolean found = false;
for (Iterator<? extends CGNode> succIter = callGraph.getSuccNodes(srcNode); succIter.hasNext();) {
CGNode succ = succIter.next();
for (CGNode succ : Iterator2Iterable.make(callGraph.getSuccNodes(srcNode))) {
if (tgtNode == succ) {
found = true;
break;
@ -346,11 +346,11 @@ public abstract class IRTests {
return new String[] { "L" + pkgName + "/" + getTestName().substring(4) };
}
protected abstract <I extends InstanceKey> AbstractAnalysisEngine<I> getAnalysisEngine(String[] mainClassDescriptors, Collection<String> sources, List<String> libs);
protected abstract <I extends InstanceKey> AbstractAnalysisEngine<I, CallGraphBuilder<I>, ?> getAnalysisEngine(String[] mainClassDescriptors, Collection<String> sources, List<String> libs);
public <I extends InstanceKey> Pair<CallGraph, PointerAnalysis<I>> runTest(Collection<String> sources, List<String> libs,
public <I extends InstanceKey> Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> runTest(Collection<String> sources, List<String> libs,
String[] mainClassDescriptors, List<? extends IRAssertion> ca, boolean assertReachable) throws IllegalArgumentException, CancelException, IOException {
AbstractAnalysisEngine<I> engine = getAnalysisEngine(mainClassDescriptors, sources, libs);
AbstractAnalysisEngine<I, CallGraphBuilder<I>, ?> engine = getAnalysisEngine(mainClassDescriptors, sources, libs);
CallGraph callGraph;
callGraph = engine.buildDefaultCallGraph();
@ -378,8 +378,7 @@ public abstract class IRTests {
Set<IMethod> unreachable = HashSetFactory.make();
IClassHierarchy cha = cg.getClassHierarchy();
IClassLoader sourceLoader = cha.getLoader(JavaSourceAnalysisScope.SOURCE);
for (Iterator<IClass> iter = sourceLoader.iterateAllClasses(); iter.hasNext();) {
IClass clazz = iter.next();
for (IClass clazz : Iterator2Iterable.make(sourceLoader.iterateAllClasses())) {
System.err.println(clazz);
if (clazz.isInterface())

View File

@ -82,103 +82,76 @@ public abstract class JavaIRTests extends IRTests {
@Test public void testTwoClasses() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
new IRAssertion() {
cg -> {
final String typeStr = singleInputForTest();
@Override
public void check(CallGraph cg) {
final String typeStr = singleInputForTest();
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
/*
Assert.assertEquals("Expected two classes.", iClass.getClassLoader().getNumberOfClasses(), 2);
/*
Assert.assertEquals("Expected two classes.", iClass.getClassLoader().getNumberOfClasses(), 2);
for (Iterator<IClass> it = iClass.getClassLoader().iterateAllClasses(); it.hasNext();) {
IClass cls = it.next();
Assert.assertTrue("Expected class to be either " + typeStr + " or " + "Bar", cls.getName().getClassName().toString()
.equals(typeStr)
|| cls.getName().getClassName().toString().equals("Bar"));
}
*/
for (IClass cls : Iterator2Iterable.make(iClass.getClassLoader().iterateAllClasses())) {
Assert.assertTrue("Expected class to be either " + typeStr + " or " + "Bar", cls.getName().getClassName().toString()
.equals(typeStr)
|| cls.getName().getClassName().toString().equals("Bar"));
}
*/
}), true);
}
@Test public void testInterfaceTest1() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
/**
* IFoo is an interface
*/
new IRAssertion() {
cg -> {
final String typeStr = "IFoo";
@Override
public void check(CallGraph cg) {
final String typeStr = "IFoo";
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
Assert.assertTrue("Expected IFoo to be an interface.", iClass.isInterface());
}
Assert.assertTrue("Expected IFoo to be an interface.", iClass.isInterface());
},
/**
* Foo implements IFoo
*/
new IRAssertion() {
cg -> {
final String typeStr = "FooIT1";
@Override
public void check(CallGraph cg) {
final String typeStr = "FooIT1";
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
final Collection<? extends IClass> interfaces = iClass.getDirectInterfaces();
final Collection<? extends IClass> interfaces = iClass.getDirectInterfaces();
Assert.assertEquals("Expected one single interface.", interfaces.size(), 1);
Assert.assertEquals("Expected one single interface.", interfaces.size(), 1);
Assert.assertTrue("Expected Foo to implement IFoo", interfaces.contains(cg.getClassHierarchy().lookupClass(
findOrCreateTypeReference("Source", "IFoo", cg.getClassHierarchy()))));
}
Assert.assertTrue("Expected Foo to implement IFoo", interfaces.contains(cg.getClassHierarchy().lookupClass(
findOrCreateTypeReference("Source", "IFoo", cg.getClassHierarchy()))));
}), true);
}
@Test public void testInheritance1() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
/**
* 'Derived' extends 'Base'
*/
new IRAssertion() {
cg -> {
final String typeStr = "Derived";
@Override
public void check(CallGraph cg) {
final String typeStr = "Derived";
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final IClass derivedClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, derivedClass);
final IClass derivedClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, derivedClass);
final TypeReference baseType = findOrCreateTypeReference("Source", "Base", cg.getClassHierarchy());
final IClass baseClass = cg.getClassHierarchy().lookupClass(baseType);
final TypeReference baseType = findOrCreateTypeReference("Source", "Base", cg.getClassHierarchy());
final IClass baseClass = cg.getClassHierarchy().lookupClass(baseType);
Assert.assertTrue("Expected 'Base' to be the superclass of 'Derived'", derivedClass.getSuperclass().equals(baseClass));
Assert.assertTrue("Expected 'Base' to be the superclass of 'Derived'", derivedClass.getSuperclass().equals(baseClass));
Collection<IClass> subclasses = cg.getClassHierarchy().computeSubClasses(baseType);
Collection<IClass> subclasses = cg.getClassHierarchy().computeSubClasses(baseType);
Assert.assertTrue("Expected subclasses of 'Base' to be 'Base' and 'Derived'.", subclasses.contains(derivedClass)
&& subclasses.contains(baseClass));
}
Assert.assertTrue("Expected subclasses of 'Base' to be 'Base' and 'Derived'.", subclasses.contains(derivedClass)
&& subclasses.contains(baseClass));
}), true);
}
@ -214,80 +187,62 @@ public abstract class JavaIRTests extends IRTests {
@Test public void testArrayLiteral1() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
/**
* 'foo' has four array instructions: - 2 SSAArrayLengthInstruction - 1
* SSAArrayLoadInstruction - 1 SSAArrayStoreInstruction
*/
new IRAssertion() {
cg -> {
@Override
public void check(CallGraph cg) {
MethodReference mref = descriptorToMethodRef("Source#ArrayLiteral1#main#([Ljava/lang/String;)V", cg.getClassHierarchy());
CGNode node = cg.getNodes(mref).iterator().next();
SSAInstruction s = node.getIR().getInstructions()[2];
Assert.assertTrue("Did not find new array instruction.", s instanceof SSANewInstruction);
Assert.assertTrue("", ((SSANewInstruction) s).getNewSite().getDeclaredType().isArrayType());
}
MethodReference mref = descriptorToMethodRef("Source#ArrayLiteral1#main#([Ljava/lang/String;)V", cg.getClassHierarchy());
CGNode node = cg.getNodes(mref).iterator().next();
SSAInstruction s = node.getIR().getInstructions()[2];
Assert.assertTrue("Did not find new array instruction.", s instanceof SSANewInstruction);
Assert.assertTrue("", ((SSANewInstruction) s).getNewSite().getDeclaredType().isArrayType());
}), true);
}
@Test public void testArrayLiteral2() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
/**
* int[] y= { 1, 2, 3, 4 } is represented in the IR as four array store
* instructions
*/
new IRAssertion() {
cg -> {
@Override
public void check(CallGraph cg) {
MethodReference mref = descriptorToMethodRef("Source#ArrayLiteral2#main#([Ljava/lang/String;)V", cg.getClassHierarchy());
MethodReference mref = descriptorToMethodRef("Source#ArrayLiteral2#main#([Ljava/lang/String;)V", cg.getClassHierarchy());
CGNode node = cg.getNodes(mref).iterator().next();
CGNode node = cg.getNodes(mref).iterator().next();
final SSAInstruction[] instructions = node.getIR().getInstructions();
// test 1
{
SSAInstruction s1 = instructions[2];
if (s1 instanceof SSANewInstruction) {
Assert.assertTrue("", ((SSANewInstruction) s1).getNewSite().getDeclaredType().isArrayType());
} else {
Assert.assertTrue("Expected 3rd to be a new array instruction.", false);
}
}
// test 2
{
SSAInstruction s2 = instructions[3];
if (s2 instanceof SSANewInstruction) {
Assert.assertTrue("", ((SSANewInstruction) s2).getNewSite().getDeclaredType().isArrayType());
} else {
Assert.assertTrue("Expected 4th to be a new array instruction.", false);
}
}
// test 3: the last 4 instructions are of the form y[i] = i+1;
{
final SymbolTable symbolTable = node.getIR().getSymbolTable();
for (int i = 4; i <= 7; i++) {
Assert.assertTrue("Expected only array stores.", instructions[i] instanceof SSAArrayStoreInstruction);
SSAArrayStoreInstruction as = (SSAArrayStoreInstruction) instructions[i];
Assert.assertEquals("Expected an array store to 'y'.", node.getIR().getLocalNames(i, as.getArrayRef())[0], "y");
final Integer valueOfArrayIndex = ((Integer) symbolTable.getConstantValue(as.getIndex()));
final Integer valueAssigned = (Integer) symbolTable.getConstantValue(as.getValue());
Assert.assertEquals("Expected an array store to 'y' with value " + (valueOfArrayIndex + 1), valueAssigned.intValue(),
valueOfArrayIndex + 1);
}
final SSAInstruction[] instructions = node.getIR().getInstructions();
// test 1
{
SSAInstruction s1 = instructions[2];
if (s1 instanceof SSANewInstruction) {
Assert.assertTrue("", ((SSANewInstruction) s1).getNewSite().getDeclaredType().isArrayType());
} else {
Assert.assertTrue("Expected 3rd to be a new array instruction.", false);
}
}
// test 2
{
SSAInstruction s2 = instructions[3];
if (s2 instanceof SSANewInstruction) {
Assert.assertTrue("", ((SSANewInstruction) s2).getNewSite().getDeclaredType().isArrayType());
} else {
Assert.assertTrue("Expected 4th to be a new array instruction.", false);
}
}
// test 3: the last 4 instructions are of the form y[i] = i+1;
{
final SymbolTable symbolTable = node.getIR().getSymbolTable();
for (int i = 4; i <= 7; i++) {
Assert.assertTrue("Expected only array stores.", instructions[i] instanceof SSAArrayStoreInstruction);
SSAArrayStoreInstruction as = (SSAArrayStoreInstruction) instructions[i];
Assert.assertEquals("Expected an array store to 'y'.", node.getIR().getLocalNames(i, as.getArrayRef())[0], "y");
final Integer valueOfArrayIndex = ((Integer) symbolTable.getConstantValue(as.getIndex()));
final Integer valueAssigned = (Integer) symbolTable.getConstantValue(as.getValue());
Assert.assertEquals("Expected an array store to 'y' with value " + (valueOfArrayIndex + 1), valueAssigned.intValue(),
valueOfArrayIndex + 1);
}
}
}), true);
}
@ -299,53 +254,41 @@ public abstract class JavaIRTests extends IRTests {
@Test public void testQualifiedStatic() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
/**
*
*/
new IRAssertion() {
cg -> {
@Override
public void check(CallGraph cg) {
MethodReference mref = descriptorToMethodRef("Source#QualifiedStatic#main#([Ljava/lang/String;)V", cg.getClassHierarchy());
MethodReference mref = descriptorToMethodRef("Source#QualifiedStatic#main#([Ljava/lang/String;)V", cg.getClassHierarchy());
CGNode node = cg.getNodes(mref).iterator().next();
SSAInstruction s = node.getIR().getInstructions()[4];
Assert.assertTrue("Did not find a getstatic instruction.", s instanceof SSAGetInstruction
&& ((SSAGetInstruction) s).isStatic());
final FieldReference field = ((SSAGetInstruction) s).getDeclaredField();
Assert.assertEquals("Expected a getstatic for 'value'.", field.getName().toString(), "value");
Assert.assertEquals("Expected a getstatic for 'value'.", field.getDeclaringClass().getName().toString(), "LFooQ");
}
CGNode node = cg.getNodes(mref).iterator().next();
SSAInstruction s = node.getIR().getInstructions()[4];
Assert.assertTrue("Did not find a getstatic instruction.", s instanceof SSAGetInstruction
&& ((SSAGetInstruction) s).isStatic());
final FieldReference field = ((SSAGetInstruction) s).getDeclaredField();
Assert.assertEquals("Expected a getstatic for 'value'.", field.getName().toString(), "value");
Assert.assertEquals("Expected a getstatic for 'value'.", field.getDeclaringClass().getName().toString(), "LFooQ");
}), true);
}
@Test public void testStaticNesting() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
new IRAssertion() {
cg -> {
final String typeStr = singleInputForTest() + "$WhatsIt";
@Override
public void check(CallGraph cg) {
final String typeStr = singleInputForTest() + "$WhatsIt";
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
// todo: this fails: Assert.assertNotNull("Expected to be enclosed in
// 'StaticNesting'.",
// ((JavaSourceLoaderImpl.JavaClass)iClass).getEnclosingClass());
// todo: is there the concept of CompilationUnit?
// todo: this fails: Assert.assertNotNull("Expected to be enclosed in
// 'StaticNesting'.",
// ((JavaSourceLoaderImpl.JavaClass)iClass).getEnclosingClass());
// todo: is there the concept of CompilationUnit?
/**
* {@link JavaCAst2IRTranslator#getEnclosingType} return null for static
* inner classes..?
*/
}
/**
* {@link JavaCAst2IRTranslator#getEnclosingType} return null for static
* inner classes..?
*/
}), true);
}
@ -356,21 +299,17 @@ public abstract class JavaIRTests extends IRTests {
@Test public void testInnerClass() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
new IRAssertion() {
cg -> {
final String typeStr = singleInputForTest();
@Override
public void check(CallGraph cg) {
final String typeStr = singleInputForTest();
final TypeReference type = findOrCreateTypeReference("Source", typeStr + "$WhatsIt", cg.getClassHierarchy());
final TypeReference type = findOrCreateTypeReference("Source", typeStr + "$WhatsIt", cg.getClassHierarchy());
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
Assert.assertEquals("Expected to be enclosed in 'InnerClass'.", ((JavaSourceLoaderImpl.JavaClass) iClass)
.getEnclosingClass(), // todo is there another way?
cg.getClassHierarchy().lookupClass(findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy())));
}
Assert.assertEquals("Expected to be enclosed in 'InnerClass'.", ((JavaSourceLoaderImpl.JavaClass) iClass)
.getEnclosingClass(), // todo is there another way?
cg.getClassHierarchy().lookupClass(findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy())));
}), true);
}
@ -379,13 +318,13 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testInnerClassA() throws IllegalArgumentException, CancelException, IOException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> x =
Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> x =
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true);
// can't do an IRAssertion() -- we need the pointer analysis
CallGraph cg = x.fst;
PointerAnalysis<InstanceKey> pa = x.snd;
PointerAnalysis<? extends InstanceKey> pa = x.snd;
Iterator<CGNode> iter = cg.iterator();
while ( iter.hasNext() ) {
@ -438,13 +377,13 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testInnerClassSuper() throws IllegalArgumentException, CancelException, IOException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> x =
Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> x =
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true);
// can't do an IRAssertion() -- we need the pointer analysis
CallGraph cg = x.fst;
PointerAnalysis<InstanceKey> pa = x.snd;
PointerAnalysis<? extends InstanceKey> pa = x.snd;
Iterator<CGNode> iter = cg.iterator();
while ( iter.hasNext() ) {
@ -471,61 +410,49 @@ public abstract class JavaIRTests extends IRTests {
@Test public void testLocalClass() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
new IRAssertion() {
cg -> {
final String typeStr = singleInputForTest();
final String localClassStr = "Foo";
/**
* Classes local to method are enclosed in the class the methods belong
* to.
*/
@Override
public void check(CallGraph cg) {
final String typeStr = singleInputForTest();
final String localClassStr = "Foo";
// Observe the descriptor for a class local to a method.
final TypeReference mainFooType = findOrCreateTypeReference("Source", typeStr + "/main([Ljava/lang/String;)V/"
+ localClassStr, cg.getClassHierarchy());
// Observe the descriptor for a class local to a method.
final TypeReference mainFooType = findOrCreateTypeReference("Source", typeStr + "/main([Ljava/lang/String;)V/"
+ localClassStr, cg.getClassHierarchy());
// Observe the descriptor for a class local to a method.
final IClass mainFooClass = cg.getClassHierarchy().lookupClass(mainFooType);
Assert.assertNotNull("Could not find class " + mainFooType, mainFooClass);
// Observe the descriptor for a class local to a method.
final IClass mainFooClass = cg.getClassHierarchy().lookupClass(mainFooType);
Assert.assertNotNull("Could not find class " + mainFooType, mainFooClass);
final TypeReference methodFooType = findOrCreateTypeReference("Source", typeStr + "/method()V/" + localClassStr, cg
.getClassHierarchy());
final TypeReference methodFooType = findOrCreateTypeReference("Source", typeStr + "/method()V/" + localClassStr, cg
.getClassHierarchy());
final IClass methodFooClass = cg.getClassHierarchy().lookupClass(methodFooType);
Assert.assertNotNull("Could not find class " + methodFooType, methodFooClass);
final IClass methodFooClass = cg.getClassHierarchy().lookupClass(methodFooType);
Assert.assertNotNull("Could not find class " + methodFooType, methodFooClass);
final IClass localClass = cg.getClassHierarchy().lookupClass(
findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy()));
final IClass localClass = cg.getClassHierarchy().lookupClass(
findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy()));
Assert.assertSame("'Foo' is enclosed in 'Local'", ((JavaSourceLoaderImpl.JavaClass) methodFooClass).getEnclosingClass(),
localClass);
// todo: is this failing because 'main' is static?
// Assert.assertSame("'Foo' is enclosed in 'Local'",
// ((JavaSourceLoaderImpl.JavaClass)mainFooClass).getEnclosingClass(),
// localClass);
}
Assert.assertSame("'Foo' is enclosed in 'Local'", ((JavaSourceLoaderImpl.JavaClass) methodFooClass).getEnclosingClass(),
localClass);
// todo: is this failing because 'main' is static?
// Assert.assertSame("'Foo' is enclosed in 'Local'",
// ((JavaSourceLoaderImpl.JavaClass)mainFooClass).getEnclosingClass(),
// localClass);
}), true);
}
@Test public void testAnonymousClass() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Arrays.asList(
new IRAssertion() {
cg -> {
final String typeStr = singleInputForTest();
@Override
public void check(CallGraph cg) {
final String typeStr = singleInputForTest();
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final TypeReference type = findOrCreateTypeReference("Source", typeStr, cg.getClassHierarchy());
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
Assert.assertNotNull("Could not find class " + typeStr, iClass);
// todo what to check?? could not find anything in the APIs for
// anonymous
}
// todo what to check?? could not find anything in the APIs for
// anonymous
}), true);
}
@ -607,15 +534,15 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testMiniaturSliceBug() throws IllegalArgumentException, CancelException, IOException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
PointerAnalysis<InstanceKey> pa = x.snd;
PointerAnalysis<? extends InstanceKey> pa = x.snd;
CallGraph cg = x.fst;
// test partial slice
MethodReference sliceRootRef = getSliceRootReference("MiniaturSliceBug", "validNonDispatchedCall", "(LIntWrapper;)V");
Set<CGNode> roots = cg.getNodes(sliceRootRef);
Pair<Collection<Statement>,SDG<InstanceKey>> y = AstJavaSlicer.computeAssertionSlice(cg, pa, roots, false);
Pair<Collection<Statement>,SDG<? extends InstanceKey>> y = AstJavaSlicer.computeAssertionSlice(cg, pa, roots, false);
Collection<Statement> slice = y.fst;
SlicerTest.dumpSlice(slice);
Assert.assertEquals(0, SlicerTest.countAllocations(slice));

View File

@ -40,7 +40,7 @@ public abstract class SyncDuplicatorTests extends IRTests {
Descriptor.findOrCreateUTF8(Language.JAVA, "(Ljava/lang/Object;)Z")), IInvokeInstruction.Dispatch.STATIC);
@Test public void testMonitor2() throws IllegalArgumentException, CancelException, IOException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> result = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> result = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
System.err.println(result.fst);
}

View File

@ -1,7 +0,0 @@
<?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.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,2 +0,0 @@
bin
domo-trace.txt*

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.java</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

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
@ -17,6 +18,7 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error
@ -77,7 +79,7 @@ org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariable
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
@ -90,6 +92,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java
Bundle-Version: 1.4.4.qualifier
Bundle-Version: 1.5.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.cast,
com.ibm.wala.core,
@ -21,3 +21,4 @@ Export-Package: com.ibm.wala.cast.java.analysis.typeInference,
com.ibm.wala.cast.java.types
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: com.ibm.wala.cast.java

View File

@ -0,0 +1,16 @@
plugins {
id 'eclipse'
}
eclipse.project.natures 'org.eclipse.pde.PluginNature'
sourceSets.main.java.srcDirs = ['src']
dependencies {
compile(
project(':com.ibm.wala.cast'),
project(':com.ibm.wala.core'),
project(':com.ibm.wala.shrike'),
project(':com.ibm.wala.util'),
)
}

View File

@ -1,5 +1,5 @@
source.. = src/
output.. = bin/
output.. = bin/main
bin.includes = META-INF/,\
.,\
OSGI-INF/l10n/bundle.properties,\

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast.java</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>WALA CAst</name>
<description>WALA Common AST core Java front-end functionality</description>
@ -45,22 +45,22 @@
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.util</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.core</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.shrike</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</dependency>
</dependencies>
@ -91,8 +91,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

View File

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

View File

@ -132,9 +132,8 @@ public class AstJavaTypeInference extends AstTypeInference {
public byte evaluate(TypeVariable lhs, TypeVariable[] rhs) {
TypeAbstraction meet = null;
for (int i = 0; i < rhs.length; i++) {
if (rhs[i] != null) {
TypeVariable r = rhs[i];
for (TypeVariable r : rhs) {
if (r != null) {
TypeAbstraction ta = r.getType();
if (ta instanceof PointType) {
if (ta.getType().equals(getStringClass())) {

View File

@ -43,7 +43,7 @@ import com.ibm.wala.util.io.FileProvider;
/**
*/
public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends AbstractAnalysisEngine<I> {
public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends AbstractAnalysisEngine<I, CallGraphBuilder<I>, Void> {
/**
* Modules which are user-space code
@ -159,12 +159,7 @@ public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends Ab
AnalysisOptions options = new AnalysisOptions(getScope(), entrypoints);
SSAOptions ssaOptions = new SSAOptions();
ssaOptions.setDefaultValues(new SSAOptions.DefaultValues() {
@Override
public int getDefaultValue(SymbolTable symtab, int valueNumber) {
return symtab.getDefaultValue(valueNumber);
}
});
ssaOptions.setDefaultValues(SymbolTable::getDefaultValue);
options.setSSAOptions(ssaOptions);
@ -172,7 +167,7 @@ public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends Ab
}
@Override
protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
protected CallGraphBuilder<? super I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make(options, cache, cha, scope);
}
}

View File

@ -16,6 +16,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
import com.ibm.wala.ipa.cha.IClassHierarchy;
@ -26,7 +27,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/
public class ZeroCFABuilderFactory {
public CallGraphBuilder make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) {
public CallGraphBuilder<InstanceKey> make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) {
Util.addDefaultSelectors(options, cha);
Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
return new AstJavaZeroXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.NONE);

View File

@ -10,6 +10,7 @@
*****************************************************************************/
package com.ibm.wala.cast.java.ipa.callgraph;
import com.ibm.wala.classLoader.Language;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.propagation.cfa.DefaultPointerKeyFactory;
@ -21,7 +22,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
public class AstJavaCFABuilder extends AstJavaSSAPropagationCallGraphBuilder {
public AstJavaCFABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
super(cha, options, cache, new DefaultPointerKeyFactory());
super(Language.JAVA.getFakeRootMethod(cha, options, cache), options, cache, new DefaultPointerKeyFactory());
}
}

View File

@ -20,6 +20,7 @@ import com.ibm.wala.cast.java.ssa.AstJavaInvokeInstruction;
import com.ibm.wala.cast.java.ssa.AstJavaNewEnclosingInstruction;
import com.ibm.wala.cast.java.ssa.EnclosingObjectReference;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.fixpoint.IntSetVariable;
import com.ibm.wala.fixpoint.UnaryOperator;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
@ -31,20 +32,18 @@ import com.ibm.wala.ipa.callgraph.propagation.LocalPointerKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerKeyFactory;
import com.ibm.wala.ipa.callgraph.propagation.PointsToSetVariable;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSANewInstruction;
import com.ibm.wala.ssa.SymbolTable;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.intset.IntSetAction;
import com.ibm.wala.util.strings.Atom;
public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraphBuilder {
protected AstJavaSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache,
protected AstJavaSSAPropagationCallGraphBuilder(IMethod fakeRootClass, AnalysisOptions options, IAnalysisCacheView cache,
PointerKeyFactory pointerKeyFactory) {
super(cha, options, cache, pointerKeyFactory);
super(fakeRootClass, options, cache, pointerKeyFactory);
}
// ///////////////////////////////////////////////////////////////////////////
@ -173,8 +172,8 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
InstanceKey[] objs = getInvariantContents(objVal);
for (int i = 0; i < objs.length; i++) {
PointerKey enclosing = new EnclosingObjectReferenceKey(objs[i], cls);
for (InstanceKey obj : objs) {
PointerKey enclosing = new EnclosingObjectReferenceKey(obj, cls);
system.newConstraint(lvalKey, assignOperator, enclosing);
}
@ -184,13 +183,10 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) {
IntSetVariable<?> tv = rhs;
if (tv.getValue() != null) {
tv.getValue().foreach(new IntSetAction() {
@Override
public void act(int ptr) {
InstanceKey iKey = system.getInstanceKey(ptr);
PointerKey enclosing = new EnclosingObjectReferenceKey(iKey, cls);
system.newConstraint(lvalKey, assignOperator, enclosing);
}
tv.getValue().foreach(ptr -> {
InstanceKey iKey = system.getInstanceKey(ptr);
PointerKey enclosing = new EnclosingObjectReferenceKey(iKey, cls);
system.newConstraint(lvalKey, assignOperator, enclosing);
});
}
return NOT_CHANGED;
@ -260,7 +256,7 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
System.err.println(("class is " + klass + ", enclosing is " + enclosingClass + ", method is " + node.getMethod()));
if (node.getMethod().isSynthetic()) {
if (node.getMethod().isWalaSynthetic()) {
return;
}

View File

@ -53,8 +53,8 @@ public class AstJavaZeroXCFABuilder extends AstJavaCFABuilder {
AnalysisScope scope, String[] xmlFiles, byte instancePolicy) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
for (int i = 0; i < xmlFiles.length; i++) {
com.ibm.wala.ipa.callgraph.impl.Util.addBypassLogic(options, scope, cl, xmlFiles[i], cha);
for (String xmlFile : xmlFiles) {
com.ibm.wala.ipa.callgraph.impl.Util.addBypassLogic(options, scope, cl, xmlFile, cha);
}
return new AstJavaZeroXCFABuilder(cha, options, cache, null, null, instancePolicy);

View File

@ -44,8 +44,8 @@ public class JavaScopeMappingInstanceKeys extends ScopeMappingInstanceKeys {
if ((m instanceof AstMethod) && !m.isStatic()) {
AstMethod M = (AstMethod) m;
LexicalParent[] parents = M.getParents();
for (int i = 0; i < parents.length; i++) {
result.add(parents[i]);
for (LexicalParent parent : parents) {
result.add(parent);
}
}
}

View File

@ -12,7 +12,6 @@ package com.ibm.wala.cast.java.ipa.slicer;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.function.Predicate;
@ -59,8 +58,7 @@ public class AstJavaSlicer extends Slicer {
public static Set<Statement> gatherStatements(CallGraph CG, Collection<CGNode> partialRoots, Predicate<SSAInstruction> filter) {
Set<Statement> result = new HashSet<>();
for (Iterator<CGNode> ns = DFS.getReachableNodes(CG, partialRoots).iterator(); ns.hasNext();) {
CGNode n = ns.next();
for (CGNode n : DFS.getReachableNodes(CG, partialRoots)) {
IR nir = n.getIR();
if (nir != null) {
SSAInstruction insts[] = nir.getInstructions();
@ -76,41 +74,25 @@ public class AstJavaSlicer extends Slicer {
}
public static Set<Statement> gatherAssertions(CallGraph CG, Collection<CGNode> partialRoots) {
return gatherStatements(CG, partialRoots, new Predicate<SSAInstruction>() {
@Override public boolean test(SSAInstruction o) {
return o instanceof AstAssertInstruction;
}
});
return gatherStatements(CG, partialRoots, AstAssertInstruction.class::isInstance);
}
public static Set<Statement> gatherMonitors(CallGraph CG, Collection<CGNode> partialRoots) {
return gatherStatements(CG, partialRoots, new Predicate<SSAInstruction>() {
@Override public boolean test(SSAInstruction o) {
return o instanceof SSAMonitorInstruction;
}
});
return gatherStatements(CG, partialRoots, SSAMonitorInstruction.class::isInstance);
}
public static Set<Statement> gatherWrites(CallGraph CG, Collection<CGNode> partialRoots) {
return gatherStatements(CG, partialRoots, new Predicate<SSAInstruction>() {
@Override public boolean test(SSAInstruction o) {
return (o instanceof SSAPutInstruction) || (o instanceof SSAArrayStoreInstruction);
}
});
return gatherStatements(CG, partialRoots, o -> (o instanceof SSAPutInstruction) || (o instanceof SSAArrayStoreInstruction));
}
public static Set<Statement> gatherReads(CallGraph CG, Collection<CGNode> partialRoots) {
return gatherStatements(CG, partialRoots, new Predicate<SSAInstruction>() {
@Override public boolean test(SSAInstruction o) {
return (o instanceof SSAGetInstruction) || (o instanceof SSAArrayLoadInstruction);
}
});
return gatherStatements(CG, partialRoots, o -> (o instanceof SSAGetInstruction) || (o instanceof SSAArrayLoadInstruction));
}
public static Pair<Collection<Statement>, SDG<InstanceKey>> computeAssertionSlice(CallGraph CG, PointerAnalysis<InstanceKey> pa,
public static Pair<Collection<Statement>, SDG<? extends InstanceKey>> computeAssertionSlice(CallGraph CG, PointerAnalysis<? extends InstanceKey> pa,
Collection<CGNode> partialRoots, boolean multiThreadedCode) throws IllegalArgumentException, CancelException {
CallGraph pcg = PartialCallGraph.make(CG, new LinkedHashSet<>(partialRoots));
SDG<InstanceKey> sdg = new SDG<>(pcg, pa, new AstJavaModRef<>(), DataDependenceOptions.FULL, ControlDependenceOptions.FULL);
SDG<? extends InstanceKey> sdg = new SDG<>(pcg, pa, new AstJavaModRef<>(), DataDependenceOptions.FULL, ControlDependenceOptions.FULL);
//System.err.println(("SDG:\n" + sdg));
Set<Statement> stmts = gatherAssertions(CG, partialRoots);
if (multiThreadedCode) {

View File

@ -17,7 +17,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -31,6 +30,9 @@ import com.ibm.wala.cast.ir.ssa.AstIsDefinedInstruction;
import com.ibm.wala.cast.ir.ssa.AstLexicalAccess.Access;
import com.ibm.wala.cast.ir.ssa.AstLexicalRead;
import com.ibm.wala.cast.ir.ssa.AstLexicalWrite;
import com.ibm.wala.cast.ir.ssa.AstPropertyRead;
import com.ibm.wala.cast.ir.ssa.AstPropertyWrite;
import com.ibm.wala.cast.ir.ssa.AstYieldInstruction;
import com.ibm.wala.cast.ir.translator.AstTranslator;
import com.ibm.wala.cast.ir.translator.AstTranslator.AstLexicalInformation;
import com.ibm.wala.cast.java.ssa.AstJavaInstructionFactory;
@ -92,7 +94,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/**
* WALA representation of a Java class residing in a source file
*
*
* @author rfuhrer
*/
public class JavaClass extends AstClass {
@ -101,7 +103,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
protected final Collection<TypeName> superTypeNames;
private final Collection<Annotation> annotations;
public JavaClass(String typeName, Collection<TypeName> superTypeNames, CAstSourcePositionMap.Position position, Collection<CAstQualifier> qualifiers,
JavaSourceLoaderImpl loader, IClass enclosingClass, Collection<Annotation> annotations) {
super(position, TypeName.string2TypeName(typeName), loader, (short) mapToInt(qualifiers), new HashMap<Atom, IField>(), new HashMap<Selector, IMethod>());
@ -123,8 +125,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
@Override
public IClass getSuperclass() {
boolean excludedSupertype=false;
for (Iterator<TypeName> iter = superTypeNames.iterator(); iter.hasNext();) {
TypeName name = iter.next();
for (TypeName name : superTypeNames) {
IClass domoType = lookupClass(name);
if (domoType != null && !domoType.isInterface()) {
return domoType;
@ -143,11 +144,11 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/** END Custom change: Common superclass is optional */
Assertions.UNREACHABLE("Cannot find super class for " + this + " in " + superTypeNames);
}
if (excludedSupertype){
System.err.println("Not tracking calls through excluded superclass of " + getName() + " extends " + superTypeNames);
}
return null;
}
@ -167,17 +168,17 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
return result;
}
private void addMethod(CAstEntity methodEntity, IClass owner, AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
protected void addMethod(CAstEntity methodEntity, IClass owner, AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
declaredMethods.put(Util.methodEntityToSelector(methodEntity), new ConcreteJavaMethod(methodEntity, owner, cfg, symtab,
hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo));
}
private void addMethod(CAstEntity methodEntity, IClass owner) {
protected void addMethod(CAstEntity methodEntity, IClass owner) {
declaredMethods.put(Util.methodEntityToSelector(methodEntity), new AbstractJavaMethod(methodEntity, owner));
}
private void addField(CAstEntity fieldEntity) {
protected void addField(CAstEntity fieldEntity) {
declaredFields.put(Util.fieldEntityToAtom(fieldEntity), new JavaField(fieldEntity, JavaSourceLoaderImpl.this, this, JavaSourceLoaderImpl.this.getAnnotations(fieldEntity)));
}
@ -201,7 +202,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
}
}
private Collection<Annotation> getAnnotations(CAstEntity e) {
protected Collection<Annotation> getAnnotations(CAstEntity e) {
Collection<CAstAnnotation> annotations = e.getAnnotations();
if (annotations == null || annotations.isEmpty()) {
return null;
@ -223,14 +224,14 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
return result;
}
}
/**
* WALA representation of a field on a Java type that resides in a source file
*
*
* @author rfuhrer
*/
private class JavaField extends AstField {
private JavaField(CAstEntity fieldEntity, IClassLoader loader, IClass declaringClass, Collection<Annotation> annotations) {
protected class JavaField extends AstField {
protected JavaField(CAstEntity fieldEntity, IClassLoader loader, IClass declaringClass, Collection<Annotation> annotations) {
super(FieldReference.findOrCreate(declaringClass.getReference(), Atom.findOrCreateUnicodeAtom(fieldEntity.getName()),
TypeReference.findOrCreate(loader.getReference(), TypeName.string2TypeName(fieldEntity.getType().getName()))),
fieldEntity.getQualifiers(), declaringClass, declaringClass.getClassHierarchy(), annotations);
@ -240,10 +241,10 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/**
* Generic DOMO representation of a method on a Java type that resides in a
* source file
*
*
* @author rfuhrer
*/
private abstract class JavaEntityMethod extends AstMethod {
protected abstract class JavaEntityMethod extends AstMethod {
private final TypeReference[] parameterTypes;
private final TypeReference[] exceptionTypes;
@ -278,7 +279,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
return parameterTypes[i];
}
private TypeReference[] computeParameterTypes(CAstEntity methodEntity) {
protected TypeReference[] computeParameterTypes(CAstEntity methodEntity) {
TypeReference[] types;
CAstType.Function type = (Function) methodEntity.getType();
int argCount = type.getArgumentTypes().size();
@ -305,7 +306,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
return exceptionTypes;
}
private TypeReference[] computeExceptionTypes(CAstEntity methodEntity) {
protected TypeReference[] computeExceptionTypes(CAstEntity methodEntity) {
CAstType.Function fType = (Function) methodEntity.getType();
Collection<CAstType> exceptionTypes = fType.getExceptionTypes();
@ -328,10 +329,10 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/**
* DOMO representation of an abstract (body-less) method on a Java type that
* resides in a source file
*
*
* @author rfuhrer
*/
private class AbstractJavaMethod extends JavaEntityMethod {
protected class AbstractJavaMethod extends JavaEntityMethod {
public AbstractJavaMethod(CAstEntity methodEntity, IClass owner) {
super(methodEntity, owner);
}
@ -362,7 +363,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/**
* DOMO representation of a concrete method (which has a body) on a Java type
* that resides in a source file
*
*
* @author rfuhrer
*/
public class ConcreteJavaMethod extends JavaEntityMethod {
@ -485,7 +486,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
super(loaderRef, cha.getScope().getArrayClassLoader(), parent, cha.getScope().getExclusions(), cha);
this.existsCommonSuperclass = existsCommonSuperClass;
}
public JavaSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, IClassHierarchy cha) {
// standard case: we have a common super class
this(true, loaderRef, parent, cha);
@ -505,7 +506,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/** BEGIN Custom change: Optional deletion of fTypeMap */
public static volatile boolean deleteTypeMapAfterInit = true;
/** END Custom change: Optional deletion of fTypeMap */
@Override
public void init(List<Module> modules) throws IOException {
@ -530,10 +531,10 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
((JavaClass) owner).addField(n);
}
private static TypeName toWALATypeName(CAstType type) {
protected static TypeName toWALATypeName(CAstType type) {
return TypeName.string2TypeName(type.getName());
}
public IClass defineType(CAstEntity type, String typeName, CAstEntity owner) {
Collection<TypeName> superTypeNames = new ArrayList<>();
for (CAstType superType : type.getType().getSupertypes()) {
@ -546,7 +547,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
if (getParent().lookupClass(javaClass.getName()) != null) {
return null;
}
fTypeMap.put(type, javaClass);
loadedClasses.put(javaClass.getName(), javaClass);
return javaClass;
@ -556,7 +557,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
public String toString() {
return "Java Source Loader (classes " + loadedClasses.values() + ")";
}
public static class InstructionFactory extends JavaInstructionFactory implements AstJavaInstructionFactory {
@Override
@ -659,10 +660,27 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
public AstLexicalWrite LexicalWrite(int iindex, String definer, String globalName, TypeReference type, int rhs) {
return new AstLexicalWrite(iindex, definer, globalName, type, rhs);
}
@Override
public AstYieldInstruction YieldInstruction(int iindex, int[] rvals) {
return new AstYieldInstruction(iindex, rvals);
}
@Override
public AstPropertyRead PropertyRead(int iindex, int result, int objectRef, int memberRef) {
assert false;
return null;
}
@Override
public AstPropertyWrite PropertyWrite(int iindex, int objectRef, int memberRef, int value) {
assert false;
return null;
}
}
private static final InstructionFactory insts = new InstructionFactory();
protected static final InstructionFactory insts = new InstructionFactory();
@Override
public InstructionFactory getInstructionFactory() {
return insts;

View File

@ -27,6 +27,7 @@ import com.ibm.wala.cast.tree.CAstControlFlowMap;
import com.ibm.wala.cast.tree.CAstEntity;
import com.ibm.wala.cast.tree.CAstNode;
import com.ibm.wala.cast.tree.CAstQualifier;
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
import com.ibm.wala.cast.tree.CAstType;
import com.ibm.wala.cast.tree.CAstType.Method;
import com.ibm.wala.cast.tree.visit.CAstVisitor;
@ -231,7 +232,9 @@ public class JavaCAst2IRTranslator extends AstTranslator {
assert owner != null : makeType(owningType).getName().toString() + " not found in " + loader;
((JavaSourceLoaderImpl) loader).defineAbstractFunction(N, owner);
if (N.getQualifiers().contains(CAstQualifier.ABSTRACT)) {
((JavaSourceLoaderImpl) loader).defineAbstractFunction(N, owner);
}
}
@Override
@ -434,6 +437,16 @@ public class JavaCAst2IRTranslator extends AstTranslator {
return getType("java.lang.Exception");
}
@Override
protected Position[] getParameterPositions(CAstEntity n) {
int offset = 0;
Position[] parameterPositions = new Position[ n.getArgumentCount() ];
if ((n.getType() instanceof CAstType.Method) && !((CAstType.Method)n.getType()).isStatic()) {
offset = 1;
}
for(int i = 0; i < n.getArgumentCount() - offset; i++) {
parameterPositions[i+offset] = n.getPosition(i);
}
return parameterPositions;
}
}

View File

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

View File

@ -0,0 +1 @@
/*.html

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.js.html.nu_validator</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.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.html.nu_validator
Bundle-Version: 1.4.4.qualifier
Bundle-Version: 1.5.1.qualifier
Export-Package: com.ibm.wala.cast.js.html.nu_validator,
com.ibm.wala.cast.js.test
Require-Bundle: com.ibm.wala.cast.js;bundle-version="1.0.0",

View File

@ -0,0 +1,29 @@
sourceSets {
main.java.srcDirs = ['src']
test.java.srcDirs = ['tests']
}
dependencies {
compile(
'nu.validator.htmlparser:htmlparser:1.4',
project(':com.ibm.wala.cast'),
project(':com.ibm.wala.cast.js'),
project(':com.ibm.wala.util'),
)
testCompile(
project(':com.ibm.wala.cast.test'),
project(':com.ibm.wala.core.tests'),
project(configuration: 'testArchives', path: ':com.ibm.wala.cast.js.rhino.test'),
project(configuration: 'testArchives', path: ':com.ibm.wala.cast.js.test'),
)
}
processTestResources {
def data = project(':com.ibm.wala.cast.js.test.data')
dependsOn data.processTestResources
from data.sourceSets.test.resources
}
test {
maxHeapSize = '800M'
}

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="com.ibm.wala.cast.js.html.nu_validator" 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="NuPresent" depends="init">
<available file="${plugin.destination}/lib/htmlparser-1.4.jar" property="nu.present"/>
</target>
<target name="fetchNu" depends="NuPresent" unless="nu.present">
<delete dir="${temp.folder}"/>
<mkdir dir="${temp.folder}"/>
<get src="http://about.validator.nu/htmlparser/htmlparser-1.4.zip" dest="${temp.folder}/htmlparser-1.4.zip"/>
<unzip src="${temp.folder}/htmlparser-1.4.zip" dest="${temp.folder}"/>
<copy file="${temp.folder}/htmlparser-1.4/htmlparser-1.4.jar" tofile="${plugin.destination}/lib/htmlparser-1.4.jar" />
<delete dir="${temp.folder}"/>
</target>
<target name="getJars" depends="fetchNu" />
<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

@ -5,7 +5,7 @@
<parent>
<artifactId>WALA</artifactId>
<groupId>com.ibm.wala</groupId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.js.html.nu_validator</artifactId>
<packaging>eclipse-plugin</packaging>
@ -61,7 +61,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

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

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.cast.js.nodejs.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.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.nodejs.test
Bundle-Version: 1.4.4.qualifier
Bundle-Version: 1.5.1.qualifier
Export-Package: NodejsRequireJsonTest,
NodejsRequireTargetSelectorResolve,
NodejsRequireTargetSelectorResolve.requireDynamic,

View File

@ -0,0 +1,19 @@
sourceSets.test {
java.srcDirs = ['src']
resources.srcDirs = ['testdata']
}
dependencies {
testCompile(
'junit:junit:4.12',
project(':com.ibm.wala.cast.js.nodejs'),
project(':com.ibm.wala.core'),
)
}
test {
maxHeapSize = '800M'
// fails with java.lang.OutOfMemoryError for unknown reasons
exclude '**/NodejsRequireTargetSelectorResolveTest.class'
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.wala</groupId>
<artifactId>WALA</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>com.ibm.wala.cast.js.nodejs.test</artifactId>
<packaging>eclipse-plugin</packaging>
@ -35,7 +35,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -22,7 +22,7 @@ import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder;
/**
* @author Brian Pfretzschner <brian.pfretzschner@gmail.com>
* @author Brian Pfretzschner &lt;brian.pfretzschner@gmail.com&gt;
*/
public class NodejsRequireJsonTest {

View File

@ -22,7 +22,7 @@ import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder;
/**
* @author Brian Pfretzschner <brian.pfretzschner@gmail.com>
* @author Brian Pfretzschner &lt;brian.pfretzschner@gmail.com&gt;
*/
public class NodejsRequireTargetSelectorResolveTest {

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="dat">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="lib" path="lib/json-20160212.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.cast"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.cast.js"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.cast.js.rhino"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.core"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.util"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.shrike"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

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