JEP 190: Pluggable Static Analyzers

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Jan 28 11:31:21 PST 2014


On 01/28/2014 11:11 AM, Eric McCorkle wrote:
> On 01/28/14 03:49, Florian Weimer wrote:
>> On 01/28/2014 01:52 AM, Jonathan Gibbons wrote:
>>> Why is JEP 190 different from the support already in javac for pluggable
>>> static analyzers, such as provided by -Xplugin?
>> The JSR 269 interface does not provide access to expressions and method
>> bodies.  It happens that through this interface, javac internals which
>> provide this information are available after casting to internal javac
>> classes.  However, this is not a supported interface, and the internal
>> javac data structures are not directly suited to implementing analysis
>> passes.
>>
> An eventual goal of the system envisioned by JEP 190 is to allow
> analysis tools to operate on javac's trees as opposed to source or
> bytecode (as is common now).  Of course, there are quite a few
> intermediate steps that have to be taken to realize that goal.

You can easily do this in JDK 8 with -Xplugin, using the com.sun.source 
API.   com.sun.source is a public supported API. Are you suggesting that 
is not enough, and that you want to start investigating a standard 
javax.* AST API?

The one piece that is missing in the -Xplugin world is easy access to 
the proto-bytecodes from a plugin.

-- Jon


More information about the compiler-dev mailing list