@Finalize is not well described anywhere in the docs


(Schalk Cronjé) #1

Continuing the discussion from New model confusion:

The closest archetype that I could think up for @Finalize, is being the new model equivalent of adding a project.afterEvaluate closure.

Can it thus be described as rules that need to be executed once all configuration has completed?


(Mark Vieira) #2

It’s really not any more complicated than what is listed in the javadoc.

Finalize rules execute after @Mutate rules, but before @Validate rules.

This is essentially just a way of “ordering” rules. Keep in mind that the model { } DSL is equivalent to a @Mutate rule. Overriding (or modifying) configuration supplied via the model DSL is the most obvious use case here.

What could potentially be clarified here is that all these rules are evaluated before the model element is used as an input to another rule. These annotation are all mutation rules, they are simply executed in a particular order.


(Schalk Cronjé) #3

@mark_vieira Are you saying @Finalize is the same as @Mutate, but just a second group of execution rules?

As you mentioned ordering; my experiments have shown that these rules all execute in alphabetical order. Is that intentional or accidental?


(Mark Vieira) #4

A @Finalize rule should execute after a @Mutate rule given they have the same subject. Other wise their behavior is identical.

There’s no guarantee of execution order that I’m aware of if you have, let’s say, two @Mutate rules with the same subject. If it is consistently alphabetical order that is just an implementation detail and I would not rely on that implicit behavior.