[Checkers] Thoughts on Type Inference: Part 1 (what framework to use)

Michael Ernst mernst at csail.mit.edu
Thu Sep 11 07:57:15 EDT 2008


Thanks for investigating what existing tools can serve as the framework for
your type inference.

> There are many static analysis frameworks for bytecode analysis: WALA,  
> Soot, ASM, etc.
> ...
> Some frameworks do not support generics.

I'm not aware of any bytecode framework that fully supports generics.

> We desire two main features in a framework:
> - AST, type and symbol information about the java code.
> - A rewriting engine to manipulate java code (mainly add annotations).

The rewriting engine seems secondary to me -- or rather, we can get away
with less support.  For example, if we know the extent (beginning and end
line and column) of each AST node, then we can probably determine enough to
do a purely textual rewriting.

An alternative that's a bit cleaner, and that you may have had in mind, is
modifying the AST, then just printing it.  Even that has potential problems
such as the possible need to re-adjust the column or line numbers of every
following AST node, and ensuring that the AST is lossless (retains all
source code information, including whether particular whitespace is spaces
or tabs).

The main issue is which tool will be the most work overall, which includes
the analysis (especially) and also the code rewriting.

I guess you've looked at


Most of these look completely inappropriate

There are others that aren't listed, such as


but I haven't ever tried to use it.


More information about the checkers mailing list