You can not do this, via AST transform. AST transform is only applicable to Groovy classes when byte[]
is JDK one.
Metaclass allows you to add your own methods and properties to class, but can't change java inner instanceof
behaviour. So, you can't add interface to JDK core class, to use in Java libraries.
Maybe, you should consider to use wrapper class, implementing Comparable
.