You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trin Wasinger edited this page Oct 20, 2026
·
6 revisions
Note
This feature only works within Groovy scripts!
Overview
Sometimes, it is beneficial to include parts of a script only under certain conditions (e.g., optional dependencies and differing client/server code). io.github.sianabeeblebrox.specter.annotation.Requires allows dropping annotated classes and methods at compile time unless a given class exists.
The logic of Requires can be inverted to instead drop the annotated class or method if a given class does exists.
If multiple Requires annotations exist on the same element, it will be dropped if any one of them would cause it to be dropped.
Dynamic Groovy is useful for conditional control within a method (e.g., invalid references within a branch that never executes), but Requires is needed to support dropping entire methods and classes for Class Transformers.