Altering AST with javac Plugin

Gunnar Morling gunnar at hibernate.org
Wed Jun 12 20:36:55 UTC 2019


Yes, it does. Thanks, Jon!

--Gunnar

Am Mi., 12. Juni 2019 um 17:12 Uhr schrieb Jonathan Gibbons <
jonathan.gibbons at oracle.com>:

>
> On 6/11/19 11:30 PM, Gunnar Morling wrote:
> > Hi,
> >
> > I recently came across a javac plug-in (i.e. implementation
> > of com.sun.source.util.Plugin) which alters/amends the AST of the
> > classes under compilation.
> >
> > Is this an "officially" foreseen usage of that plug-in API? Or i this
> > rather a hack akin to annotation processor implementations that cast
> > the model types to the javac-internal ones in order to modify them?
> > I'm curious, because those AST-modifying annotation processors are
> > troublesome to deal with for other processors which won't "see" those
> > amendments, so I'm wondering whether one would or would not have
> > similar issues when altering the AST with such c.s.s.u.Plugin
> > implementation.
> >
> > Thanks,
> >
> > --Gunnar
> >
>
> Gunnar,
>
> There is no publicly supported API in the jdk.compiler module (or any
> other module) for modifying an AST during a compilation.  Does that
> answer your question?
>
> -- Jon
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20190612/a966ff2f/attachment.html>


More information about the compiler-dev mailing list