[
https://issues.apache.org/jira/browse/GROOVY-10378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-10378.
------------------------------
> Provide a mechanism to prioritise AST transforms running at the same stage
> --------------------------------------------------------------------------
>
> Key: GROOVY-10378
> URL: https://issues.apache.org/jira/browse/GROOVY-10378
> Project: Groovy
> Issue Type: Improvement
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
> Fix For: 4.0.0-rc-1
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> h2. Overview
> As compilation proceeds, the compiler's data structures typically gain
> additional information as the various parts of the compiler enrich that data.
> Ideally, AST transforms should be invoked once all of the compiler mdata they
> need is ready. However, the order of processing becomes a secondary factor in
> determining what phase a transform will run.
> AST Transforms target a particular phase with transforms in earlier phases
> running first. For transforms in the same phase, the order they appear in the
> source code determines which ones run first. If framework writers rely on
> certain transforms to run first, they might delay some transforms to later
> stages. This places additional constraints on framework writers which are
> further compounded when using annotation collectors (meta-annotations) since
> they list component transforms in a particular order.
> This issue is to allow framework developers some ability to order transforms
> in the same phase using a priority. Transforms with a higher priority
> (determined by an integer value) run first.
> If no priority is given, a priority of 0 is assumed. Transforms with the same
> priority run in the order in which they appear. To make a transform run
> before others, give it a higher positive value. A negative priority will send
> the transform to the end of the list. AST transforms need to implement the
> \{{TransformWithPriority}} interface if they want to alter their priority.
> Positive values will run ahead of those with priority 0 which run ahead of
> those with negative priorities. Transforms typically run after all of the
> inbuilt compiler steps have been undertaken. This behavior hasn't changed,
> just the order within the normal AST transformation processing steps is
> potentially changed.
> h2. Out of Scope
> * Widescale changing many of the internal Groovy transforms away from the
> default priority of 0 (\{{TupleConstructor}} has a slightly raised priority
> so that constructors it creates will be available to other transforms also at
> the same phase)
> * Any mechanism for negotiating priority between frameworks (frameworks can
> choose how they assign priorities)
> * Any mechanism for end users to alter the priority (it is baked into the
> AST transform definition not usage of the transform annotation)
--
This message was sent by Atlassian Jira
(v8.20.1#820001)