I'm afraid the latest CompilePhase where you can use that approach is CONVERSION. That means that in order to achieve what you wanted, you should be using a global transformation.
Then you can make the ClassNode to implement the given trait . Hope this helps :) Mario 2016-04-20 22:08 GMT+02:00 John Smiljanic <john.smilja...@gmail.com>: > Hi All, > > Groovy 2.3.7. > > I've been experimenting with trying to add a Trait (or Mixin) to a > ClassNode during semantic analysis (compiler phase). I've tried using > ClassNode::addInterface and ClassNode::addMixin passing the appropriate. I > sort of expected ClassNode to have an addTrait or something like. > > Is setting a trait at this phase of compilation supported? > > JR >