Hello Groovy users/devs I have a derived class from List (lets call this MyImmutableList) and I want to only allow the use of certain extension functions. For example, collect is ok, but left shift is not
myImmutableList << 100 // I want to prevent this because its an immutable list) myImmutableList.collect { it + 1 } // This is ok How do I achieve this? I have my own AST transformations and I can detect the use of the MyImmutableList class. My first guess is - Enable Static compile - Post static compile, detect all extension methods and the object inferred_type it is called on. If type is MyImmutableList, check if extension method is allow listed. If not cause compile error I am not sure if this is fool proof. Are there easier ways to do this? Is it possible to get the static compile mechanism to tie unknown methods to a default method that I can check for and just error on? regards Saravanan