|
Re: Data flow analysis in JDT compiler [message #1015377 is a reply to message #1015282] |
Thu, 28 February 2013 12:22 |
Stephan Herrmann Messages: 1853 Registered: July 2009 |
Senior Member |
|
|
What analysis is performed, can best be seen from this list of warning options:
http://help.eclipse.org/topic/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm
Some of these operate at the level of type resolution but some do involve flow analysis. Some flow analysis is mandatory as per the JLS, other is specific to ECJ. Aside from the mandatory definite-assignment analysis the most sophisticated flow analysis is for detecting null dereferences, but, e.g., also the detection of (potential) resource leaks involves flow analysis.
Only few of these analyses are geared towards optimization (e.g., elimination of unused local variables), most relate in fact to the detection of potential programming problems.
If you want to learn how this analysis works, the point of reference is the source code.
The central infra structure for this can be found in
http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/tree/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow
The details are implemented in analyseCode methods throughout all classes of the AST.
HTH,
Stephan
|
|
|
Powered by
FUDForum. Page generated in 0.02521 seconds