[code-reflection] RFR: Turn compiler plugin into simple SPI
Paul Sandoz
psandoz at openjdk.org
Mon Nov 18 17:16:22 UTC 2024
On Mon, 18 Nov 2024 14:18:09 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This PR is a small followup to the changes to turn compiler code reflection support into a compiler plugin.
> Turns out that the new plugin required several hacks and workaround, to make sure that the plugin would only run when strictly required (not to affect outcome of compilation if the plugin was disabled). We can get rid of all such workarounds by turning the plugin into a plain and simple SPI. There is a new `ReflectMethodsProxy` interface, which is implemented by the new module (see `ReflectMethods.Provider`). This allows javac to more or less call into the new pipeline step as it did before the incubating change, which leads to code that is much simpler to maintain.
Perhaps we should rename `ReflectMethodsProxy` to `CodeReflectionTransformer` use similar naming?
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ReflectMethodsProxy.java line 39:
> 37: public interface ReflectMethodsProxy {
> 38: /**
> 39: * Analyze the {@code CodeReflection} annotations in the method of the provided class.
And quotable/quoted lambda expressions.
-------------
Marked as reviewed by psandoz (Lead).
PR Review: https://git.openjdk.org/babylon/pull/275#pullrequestreview-2443229554
PR Review Comment: https://git.openjdk.org/babylon/pull/275#discussion_r1846961380
More information about the babylon-dev
mailing list