You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2021/11/26 08:37:12 UTC

[groovy-website] branch asf-site updated: GROOVY-10378: Provide a mechanism to prioritise AST transforms running at the same stage (release note)

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new a0b611c  GROOVY-10378: Provide a mechanism to prioritise AST transforms running at the same stage (release note)
a0b611c is described below

commit a0b611c90b7fce9e5cf47997a9456f0e60f58fd3
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Nov 26 18:36:59 2021 +1000

    GROOVY-10378: Provide a mechanism to prioritise AST transforms running at the same stage (release note)
---
 site/src/site/releasenotes/groovy-4.0.adoc | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/site/src/site/releasenotes/groovy-4.0.adoc b/site/src/site/releasenotes/groovy-4.0.adoc
index 71a1870..59861ae 100644
--- a/site/src/site/releasenotes/groovy-4.0.adoc
+++ b/site/src/site/releasenotes/groovy-4.0.adoc
@@ -906,6 +906,24 @@ In addition, type annotations that appear in code,
 e.g. local variable types, cast expression types, catch block exception types,
 are still work in progress.
 
+=== AST transformation priorities
+
+The order in which AST transforms are processed is determined first by the `phase`
+declared in a transform's `@GroovyASTTransformation` declaration.
+For transforms declared to be in the same phase, the order in which the
+associated transform annotations appear in the source code is then used.
+
+Now, transformation writers can also specify a priority for their transforms.
+To do so, the AST transformation must implement the `TransformWithPriority` interface
+and return their priority as an integer in the implemented `priority()` method.
+The default priority is `0`. The transformation with the highest positive priority
+will be processed first. Negative priorities will be processed after all transformations
+with a priority of zero (the default).
+
+Note that transformations are still all processed together. The priority only
+affects ordering between other transformations. Other parts of the respective
+compiler phase remain unchanged.
+
 [[Groovy4.0-ongoing]]
 == On-going work