Commit Graph

50 Commits

Author SHA1 Message Date
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
Ben Liblit ba71f45119 "@throws" should be followed by class name and space, not comma 2017-12-19 16:53:55 -06: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
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 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 191904d607 Remove "throws XYZ" declarations where XYZ cannot be thrown
Unnecessary "throws" declarations tend to cascade.  If foo() calls
bar() and bar() falsely declares that it might throw IOException, that
often leads a programmer to declare that foo() might throw IOException
as well.  Fixing the bar() throws declaration then reveals that we can
fix the foo() throws declaration too.  By the time we reach a fixed
point with cleaning these up, we have removed roughly 320 unnecessary
throws declarations.

In a few cases, this cleanup even lets us remove entire "try
... catch" statements where the only thing being caught was an
exception that we now statically know cannot be thrown.  Nice!

In Eclipse project configurations, upgrade any future such shenanigans
from warnings to errors.  Now that we've fixed this, we don't want it
coming back again.

There is a potential drawback to this change.  Conceivably some public
WALA API entry point might have declared that it could throw some
exception merely to reserve the *option* of throwing that exception in
third-party code that subclasses and overrides the API entry point in
question.  I have no idea whether this is a significant concern in
practice, though.
2017-07-28 10:20:28 -07:00
Ben Liblit 594525a83f Fix Eclipse warnings about methods that can be declared static
The fix is to add "static" where appropriate, of course.  I've also
simplified calls to such methods to reflect the fact that they no
longer need a specific object to call the method on.

In projects that contain test inputs, I've left the non-static
declarations unchanged, and instead downgraded the warning to be
ignored.  In all other projects, this warning has been upgraded to an
error.
2017-07-14 22:38:38 -07:00
Ben Liblit 4cef26162c Add @Override annotations wherever possible (#178)
* Fix warnings about unset javacProjectSettings build entries

Specifically, these are all warnings of the form "The
'javacProjectSettings' build entry should be set when there are project
specific compiler settings".

* Add @Override annotations to all methods that do override

This fixes 287 Eclipse code style warnings.

* Cannot add @Override annotations here, so suppress warnings instead

We should be able to add these @Override annotations in the future,
one Eclipse Mars and earlier are no longer supported.  For now,
though, they have to go away in order to be compatible with older
Eclipse releases.
2017-05-08 07:39:49 -07:00
Martin Hecker 8e773fcf88 in order to look up instruction-indices from a bytecode-indices, do a binary search on the existing pcMap array (as suggested by Julian Dolby).
also see https://sourceforge.net/p/wala/mailman/message/35518796/ and answers.
2016-12-05 18:52:37 +01:00
Ben Liblit ed0ddd780f Correct HTML embedded in Javadoc comments
Most of the invalid HTML arose from bare "<" and ">" characters.
These should be escaped as "&lt;" and "&gt;" when not intended to
introduce HTML tags.  When you have many such characters close
together, "{@literal ...}" is a nice, readable alternative that
automatically escapes its contents.  If the text in question is
intended to be a code fragment, then "{@code ...}"  is appropriate:
this is essentially equivalent to "<code>{@literal ...}</code>".

There were a few other HTML violations too, but none common enough to
be worth detailing here.
2016-11-28 11:14:41 -06: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
Juergen Graf d77cfc60fc incorporate changes from other branch
- Annotation support
- Properly fix path-with-spaces bug.
- fix bug involving paths with spaces
- add a simple driver for building a call graph via a scope file
- Properly return null as default constructor of an array.
- organize imports
- better handling of missing bytecodes
- javadoc
- test fix
- small Javadoc fix
- added date-property.js
- 1) added InstanceKey.getCreation sites and its implementations 2) fixes for issues with keys representing dynamic properties   i) all properties are converted to strings,
- publicize method makeClasspath().  deprecate quoteStringIfNeeded()
- organize imports
- javadoc
- renamed classes to make relationship to mod-ref analysis clearer
- add support for lexical writes
- Code to compute transitive lexical accesses of methods.
- extract some generally useful code from ModRef
- Generate proper InstanceFieldKeys for property accesses with Numbers.
- rewrite to make hardest test appear last
- fix test to properly check reachability
- add an array test that doesn't quite work
- add method to get a PointerKey for a global
- compare FieldValueDispatch objects based on CGNode as well
- Handle duplicate field names between subclass and superclass.
2013-02-06 12:34:25 +01:00
Manu Sridharan ba228963bf better handling of missing bytecodes
In some cases, class files will have non-abstract methods with no
bytecodes (e.g., stubs for compilation purposes).  While such a class
file is invalid, we want to enable clients to handle such an error.
With these changes, Shrike will throw an InvalidClassFileException for
such cases, and WALA's IR construction code will throw a
WalaRuntimeException.
2013-01-21 15:27:13 -08:00
Juergen Graf b82d5dba90 Merge branch 'wala' into master 2012-11-06 04:23:10 +01:00
Manu Sridharan 256cd06460 Convert all Java source files to use Unix line endings; no semantic change 2012-09-04 15:56:05 -07:00
Juergen Graf a76f93a28c Merge branch 'wala' into master 2011-04-13 13:02:15 +02:00
msridhar1 2b87f070a7 make getBCInfo() synchronized to prevent duplicate code loading by different threads
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4113 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2011-04-12 19:20:13 +00:00
Juergen Graf 47711fd310 read enhanced bytecode postions from class attributes 2011-03-30 13:03:16 +02:00
dolby-oss 00871016cb adapt to checkcast change
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3817 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2010-04-28 19:33:34 +00:00
msridhar1 05744fe19b change isVolatile() in IMethod to isBridge(), better reflecting Java spec
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3777 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-12-03 16:56:49 +00:00
sjfink 6f96d41dc2 remove unnecessary InvalidClassFileException declarations
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3618 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-05-29 14:23:29 +00:00
sjfink de6adbc4d7 more migration to Java assertions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3559 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-05-01 17:42:28 +00:00
sjfink c8bfcb7240 comments
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3524 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-22 19:17:03 +00:00
sjfink 2bf8eab491 tweak comments
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3494 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-21 19:31:33 +00:00
sjfink 77101da20f misc. cleanups
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3434 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-04-10 19:48:32 +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
msridhar1 51bd8d2c26 more generics; make ZeroXInstanceKeys.smushMap protected
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3382 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-03-30 20:41:17 +00:00
dolby-oss b2bae33bab generalize parsing of Descriptors to also handle languages other than Java
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3366 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-03-26 15:11:45 +00:00
dolby-oss 1b1c7f2b3f further Shrike refactoring to generalize instructions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3274 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-03-11 13:33:00 +00:00
msridhar1 3207e2f5cc small cleanups
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3259 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-03-06 15:23:02 +00:00
dolby-oss aad54f7abc further Shrike refactoring to generalize instructions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3241 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-02-26 16:50:52 +00:00
dolby-oss b61135c8be adapt to Shrike changes: divorce SSAInstruction from the Shrike Instruction, which requires adding a type parameter to ControlFlowGraph and propagating that change. Also, stop using the JVML opcode in a few places where it was (unnecessarily) being used.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3227 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2009-02-19 15:58:31 +00:00
msridhar1 b42e61dda5 add method to get number of Shrike instructions
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3128 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-12-11 02:16:18 +00:00
msridhar1 2b210ddb54 added ability to scan for array writes
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3063 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-10-22 15:37:15 +00:00
sjfink dc39a8dd86 refactoring: move some classes into appropriate packages
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2452 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-01-24 22:20:38 +00:00
sjfink e6a904b715 just refactoring ... introduce 2 new packages in wala.util.
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2446 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2008-01-24 22:05:28 +00:00
sjfink b58bf27b90 fix buggy logic with invokestatic and NPE
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2212 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-12-17 19:01:46 +00:00
sjfink d445f0861a change ControlFlowGraph.getExceptionalSuccessors to return a List, in order of increasing catch scope
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1822 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-10-04 15:48:46 +00:00
sjfink 705d847699 push generics signatures down into ShrikeCTMethod
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1250 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-06-06 18:06:45 +00:00
sjfink 65cc4433cd make some fields final
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1244 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-06-05 14:01:26 +00:00
sjfink 8e52444761 make many fields final
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1232 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-06-01 21:38:35 +00:00
sjfink 9c58d8e2a8 change some Iterators in API to Collections
remove some unnecessary WarningSet parameters

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1208 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-05-31 02:38:49 +00:00
sjfink ea3caa1e8a mostly clean up old comments.
also rename InferGraphRootsImpl to InferGraphRoots

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1200 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-05-30 19:05:23 +00:00
sjfink fdb7a17af3 add @Overrides annotations and nuke unnecessary casts
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1197 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-05-30 15:16:05 +00:00
sjfink 46eeca59af Feature 1718799: refactor ShrikeUtil.makeMethodReference and makeFieldReference
into MethodReference and FieldReference findOrCreate()s

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1112 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-05-14 17:53:49 +00:00
sjfink 2870d1dbc8 soft caching of bytecode info and small API changes
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@881 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-03-22 15:48:54 +00:00
sjfink b85c5fc3a5 a little immature generics support
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@560 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-01-11 17:51:29 +00:00
sjfink 429403c321 rename Shrike*Wrapper to just Shrike*
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@552 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
2007-01-10 20:51:00 +00:00