I'm trying to detect certain types of bad smells in java source code. Some of these detentions imply, for instance, finding out, for a certain variable X of a statement in the code, every other variable which may play a role into changing variable X value. This is a typical operation doable over a Data flow graph of a java program... (Finding which variables a variable depends or may depend on... or which variables a variable may influence).
Another operation I would need is for instance, determining whether exists a possible execution flow, such as a certain method is never called. (This could be used, for instance, to find out whether a variable is always initialized with a setValue(v) method). I guess I could use the control flow graph for this.
Slicing is also an operation I will probably will want to use in the future.
Eclipse's AST api is very usefull, but these operations can't be done in a trivial way with just it.
So basically, I would like to be able to generate the control flow graph, data flow graph, .. and run some analysis operations over them and integrate those analysis with an eclipse plugin I'm developing. Hopefully I can easily cross information from some tests I do using eclipse's AST api with wala? (I suspect WALA uses eclipse AST even thought I'm not sure)
The javadoc of the Graph class in WALA makes me think that there's a lot of interesting and useful stuff to explore...
While I cannot give a good walla answer, I feel like suggesting to do what I did, which is to use soot
--
Marc-André Laverdière
PhD Candidate - Doctorant
Sent from a mobile device - please excuse the brevity
>------------------------------------------------------------------------
>
>------------------------------------------------------------------------------
>Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
>Get 100% visibility into your production application - at no cost.
>Code-level diagnostics for performance bottlenecks with <2% overhead
>Download for free and get started troubleshooting in minutes.
>http://p.sf.net/sfu/appdyn_d2d_ap1
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Wala-wala mailing list
>Wala...@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/wala-wala
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Wala-wala mailing list
Wala...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wala-wala
Hi there,
So, you may want to look through the WALA tutorial slides as a start:
http://wala.sourceforge.net/wiki/index.php/Tutorial
Hopefully that will give a reasonable overview of how the system works. For data flow graphs and data flow analysis, you can check out the IntrapocReachingDefs analysis as an example:
https://github.com/wala/WALA/blob/master/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/dataflow/IntraprocReachingDefs.java
There are also interprocedural versions, both context-insensitive and context-sensitive:
https://github.com/wala/WALA/blob/master/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/dataflow/ContextInsensitiveReachingDefs.java
https://github.com/wala/WALA/blob/master/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/dataflow/ContextSensitiveReachingDefs.java
All of these analyses operate on WALA IRs, which provide control-flow graphs for methods:
http://wala.sourceforge.net/wiki/index.php/UserGuide:IR
And here's some info on the slicer:
http://wala.sourceforge.net/wiki/index.php/UserGuide:Slicer
In terms of JDT compatibility, I think all of the above should work with the JDT front-end. For the slicing functionality, you'll want to look at AstJavaSlicer:
https://github.com/wala/WALA/blob/master/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ipa/slicer/AstJavaSlicer.java
Since the WALA analyses operate on the IR, you'll need to map analysis results back to the source code, for which we have decent support:
http://wala.sourceforge.net/wiki/index.php/UserGuide:MappingToSourceCode
Anyway, hopefully that's enough to get you going. If you have further questions, let us know.
--Manu
-------------------------------------------
Manu Sridharan
IBM T.J. Watson Research Center
http://researcher.ibm.com/view.php?person=us-msridhar
João Macedo ---05/06/2013 09:44:05 AM---I've been trying to look at the code in the JUnit tests and make some sense of what I see... Debuggi
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1_______________________________________________
Wala-wala mailing list
Wala...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wala-wala
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Hi there,
So, the slides in the WALA tutorial focus on analyzing Java bytecode, accessed via the file system or class loaders. So, for your example code, you either need to have TesteWALA.jar in the classpath, or you need to give an absolute path to the file.
If you want to analyze an Eclipse project from an Eclipse plug-in, you probably want to use a class like com.ibm.wala.cast.java.client.JDTJavaSourceAnalysisEngine. You can construct an object using the relevant IJavaProject, and then get an AnalysisScope using the makeAnalysisScope() method. The whole AnalysisEngine type hierarchy is a bit complex, but you can look at this code to see how it builds a call graph builder and call graph:
https://github.com/wala/WALA/blob/master/com.ibm.wala.core/src/com/ibm/wala/client/AbstractAnalysisEngine.java#L295
We should write some better documentation on analyzing Eclipse projects; it's on the TODO list.
Thanks,
Manu
-------------------------------------------
Manu Sridharan
IBM T.J. Watson Research Center
http://researcher.ibm.com/view.php?person=us-msridhar
João Macedo ---05/09/2013 03:59:09 PM---Hey. Thanks for your reply and your patience with me. I know I'm always asking basic questions but h