Commit Graph

47 Commits

Author SHA1 Message Date
Julian Dolby 9aed4e058d more tracking of sourse positions for function parameters 2018-06-05 15:00:31 -04:00
Julian Dolby c8cdaf8616 further refactoring to enable more reuse
eliminate all non-jva 8 compilation
2018-02-05 15:18:37 -08:00
Ben Liblit cb6d3b282a Fix Eclipse warnings about redundant null checks and assignments
Most of these are harmless, and are best fixed simply by removing the
redundant check or assignment.  The one in FlowType.compareBlocks,
however, revealed a real problem.  This code checks for nullness of
`a` *after* having called a method on `a`.  Assuming that `a` can
indeed be `null` here, the check must come first to avoid a
`NullPointerException`.

In several places, I saw code of this form:

   if (thing == null)
     assert thing != null : ... ;

I honestly don't understand the purpose of that `if` statement.  Why
not just have the `assert` statement there directly?  I removed the
seemingly irrelevant `if` statements in these cases, but if this is
some intentional pattern, please explain it to me.

In a few places where nullness is statically known but non-obvious,
add assert statements to point out what's going on to help future
developers.

Upgrade future such warnings to errors to keep us moving in a cleaner
direction.
2017-08-15 09:11:29 -07:00
Ben Liblit 6087b73cee Fix or suppress all 242 Eclipse warnings about unused parameters
In general, my approach was to try to eliminate each unused parameter
using Eclipse's "Change Method Signature" refactoring.  That did not
always succeed: a parameter may be unused in some base class method,
but then be used in subclass's override of that method.  In cases
where refactoring to eliminate a parameter failed, I instead annotated
the parameter with '@SuppressWarnings("unused")' to silence the
warning.

Note: this group of changes creates a significant risk of
incompatibility for third-party WALA code.  Some removed parameters
change externally-visible APIs.  Furthermore, these changes do not
necessarily lead to Java compilation errors.  For example, suppose
third-party code subclasses a WALA class or interface, overrides a
method, but does not annotate that method as @Override.  Removing a
parameter means that the third-party method no longer overrides.  This
can quietly change code behavior without compile-time errors or
warnings.  This is exactly why one should use @Override wherever
possible, but we cannot guarantee that third-party WALA users have
done that.
2017-07-31 15:29:00 -07:00
Ben Liblit e316471d88 Fix nearly all Eclipse warnings about using raw types
Along the way, I also converted many "for (;;)" loops into modern
"for (:)" loops.  I didn't systematically look for all opportunities
to do this, though.  I merely made this change where I was already
converting raw Iterator uses into modern Iterator<...> uses.

Better use of generics also allowed many casts to become statically
redundant.  I have removed all such redundant casts.

Only three raw-types warnings remain after this batch of fixes.  All
three involve raw uses of CallGraphBuilder.  I've tried to fix these
too, but it quickly snowballs into a cascade of changes that may or
may not eventually reach a statically-type-save fixed point.  I may
give these last few problem areas another go in the future.  For now,
though, the hundreds of other fixes seem worth keeping even if there
are a few stragglers.

This commit may change some public APIs, but only by making weaker
type signatures stronger by replacing raw types with generic types.
For example, we may change something like "Set" into "Set<String>",
but we're not adding new arguments, changing any
underlying (post-generics-erasure) types, etc.
2017-07-12 10:39:06 -07:00
Ben Liblit 72c754e874 Declare private methods static wherever possible
If a method is private, there's no risk that a subclass elsewhere
might be overriding it and depending on dynamic dispatch to choose the
right implementation.  So all of these private methods can safely be
declared static without risk of regression in either WALA code or
unseen third-party code.
2017-06-07 08:29:23 -07:00
Julian Dolby a8a3699ee1 type cleanups 2017-02-23 10:10:39 -05:00
Julian Dolby 7a69f752d0 type cleanups 2017-01-11 08:04:37 -05:00
Juergen Graf 428a3975ed Merge branch 'wala' into master
Conflicts:
	com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java
	com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ssa/AstJavaInstructionFactory.java
	com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ssa/AstJavaInvokeInstruction.java
	com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimpleCallGraphShape.java
	com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/WebPageLoaderFactory.java
	com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/loader/JavaScriptLoader.java
	com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionFactory.java
	com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptInvoke.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/AstCallGraph.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AbstractLexicalInvoke.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionFactory.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstLexicalRead.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstLexicalWrite.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/FixedParametersInvokeInstruction.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/translator/AstTranslator.java
	com.ibm.wala.core/.classpath
	com.ibm.wala.core/.settings/org.eclipse.jdt.core.prefs
	com.ibm.wala.ide/src/com/ibm/wala/ide/util/ProgressMonitorDelegate.java
	com.ibm.wala.util/src/com/ibm/wala/util/NullProgressMonitor.java
	com.ibm.wala.util/src/com/ibm/wala/util/ProgressMaster.java
2014-05-20 17:59:16 +02:00
Julian Dolby 893f4b7308 type in CAst var decls 2014-03-16 18:05:49 -04:00
Juergen Graf cdaaddf88b Merge branch 'wala' into master 2013-07-02 14:23:24 +02:00
Julian Dolby 080325b5f6 merge 2013-06-25 11:57:37 -04:00
Manu Sridharan 162a001ce6 remove more code for older lexical access scheme 2013-06-07 09:58:25 -07:00
Manu Sridharan 6c9cf10870 flipped useLocalValsForLexicalVars to false for Java; causes tests to break 2013-04-29 16:48:19 -07:00
Julian Dolby 1cc5e5ce9c fixes for bug with dead code and exception handlers 2013-04-10 21:16:12 -04:00
Juergen Graf 7477b1730b Merge branch 'wala' into master 2012-03-19 13:33:48 +01:00
msridhar1 78ef6e3a03 further work
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4465 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-02-17 20:15:26 +00:00
msridhar1 9ad5c55d85 generate lexical access instructions for methods accessing their own exposed vars. still need to fix call graph construction
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4461 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-02-17 20:14:26 +00:00
dolby-oss 4c6d062dbb blunt force trauma to CAst frond end:
1) Structural changes in the AstTranslator to allow retranslation and generation of custom IR.  This is mostly moving state from the translator itself into the context.
2) Some refactoring to share some AST generation code across the Java and JavaScript front ends.
3) Switching to the latest Rhino, release 1.7R3; this is a pervasive change to the JavaScript Rhino translator, since it involves switching to the new AST interface in Rhino.
4) Common code to, as an option, translate Do-style loops by replicating the loop body.  This allows the use of CAstNode.LOOP forms for such loops.
5) Some bug fixes to the mechanisms of the CAstRewriter to handle weird control flow cases.
6) An example of retranslation to specialize JavaScript methods based on how many arguments they receive at call sites.


git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4425 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2012-01-27 20:15:33 +00:00
msridhar1 59e46916ce Generalize certain IR data structures to be less Java-specific. Generalize annotations code to allow for reading annotation parameters. Various other fixes
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4290 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-12-28 17:03:27 +00:00
Juergen Graf f8d6f5b917 Merge branch 'wala' into master 2011-05-27 12:25:53 +02:00
dolby-oss 4da02a9125 Changes to extend supported context sensitivity to CPA-style:
1) extend ContextSelector interface to allow it to specify parameters of interest
  2) extend filtering mechanism at call sites to allow CPA-style filtering when requested by contexts
  3) various related fixes and extensions:
    a) removed redundant code to handle dispatch for JavaScript, so now it shares the core mechanism
    b) tighten types for operators that take an array of args - now the array is T[] at the cost of a few array allocation methods
    c) a bit more support for empty int sets
    d) void function objects
    e) bug fixes for lexical scoping support, and adaptation to work with core dispatch mechanism
    f) example of CPA-style sensitivity to handle nastiness in a JavaScript for(.. in ...) loop
    

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4150 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-27 13:58:56 +00:00
msridhar1 0ce752ccff formatting
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4129 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-20 23:08:17 +00:00
dolby-oss 67d26e74c5 allow IR translator to give warnings and errors via the loader
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4125 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-14 01:16:36 +00:00
Juergen Graf 7c518d1867 added instruction index field to SSAInstruction (javascript not working atm) 2011-04-12 19:49:06 +02:00
dolby-oss c4891ba35d fixes to defining types
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4088 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-04 15:17:31 +00:00
dolby-oss e4b9d03be5 bug fixes for unicode names and to prevent analysis from modifying the symbol table
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3936 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-09-14 20:29:05 +00:00
dolby-oss e877067710 Ishizaki-san's patch for hasMonitorOp
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3733 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-07-17 13:58:55 +00:00
rmfuhrer ff82965836 Extracted a common subexpression to a local in defineFunction().
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3567 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-05-05 15:52:32 +00:00
sjfink 9939142eae switch from Assertions._assert to Java assertions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3555 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-30 13:16:52 +00:00
sjfink 6868b753eb organize imports and tweak comments
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3439 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-13 13:50:45 +00:00
dolby-oss e80dc6ef8c refactor handling of constants in Shrike to abstract away from Java bytecode
introduce factories to create SSAInstruction objects


git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3433 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-10 18:33:07 +00:00
dolby-oss 1cb571d1f0 add some missing exception edges
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3273 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-03-11 13:30:52 +00:00
dolby-oss 9979d0899c more fixes to lexical scoping for JavaScript
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3196 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-01-30 16:33:22 +00:00
msridhar1 5fd0909a7d changed execution environment to J2SE1.5. Fixed some warnings.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3113 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-12-02 17:01:50 +00:00
dolby-oss 577d3b9875 enhancements to handling of lexical scoping; fixes for X10
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3110 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-12-02 14:08:57 +00:00
dolby-oss a02c79527e Fixes for exceptions thrown by array accesses (incomplete)
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2981 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-07-31 21:27:10 +00:00
dolby-oss b648bd3ceb committed patch from Evan Battaglia to support outer.new inner() form. Thanks!
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2591 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-02-18 15:17:16 +00:00
dolby-oss acaea8e3cf fixes for generation of conversion instructions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1896 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-10-18 02:52:45 +00:00
rmfuhrer 406d5297c1 Made doArrayRead() and doArrayWrite() public, per API change.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1454 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-07-12 22:50:28 +00:00
sjfink 192f06a387 massive overhaul of Warnings management
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1384 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-07-06 22:08:34 +00:00
sjfink 5d6eb70c5b miscellaneous housekeeping
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1365 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-07-06 03:07:24 +00:00
dolby-oss bea163df41 use new boolean-typed constant values; handle uninitialized values for weird cases involving lexical scoping
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@921 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-04-04 13:03:33 +00:00
dolby-oss da7dea28cf add exceptions from checkcast instructions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@787 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-02-25 02:18:23 +00:00
dolby-oss 06c5431ba0 fixes to handling of enclosing objects for inner classes
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@703 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-02-09 18:19:13 +00:00
dolby-oss 55e7a45e53 first cut at handling inner classes properly; moving around of code for analysis engines to make them provide a default way to build a call graph
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@657 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-02-07 18:51:19 +00:00
dolby-oss c4b9499bd2 Initial contribution of core script analysis code
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@618 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-02-02 17:20:09 +00:00