While upgrading Grails and, by extension, Groovy on a legacy system this error started to happen in lots of places. The generic class had a method which was being overridden anonymously in the code. The problem was that on instantiation the generic type wasn't filled. As @Override wasn't honored before, it worked. When I upgraded this error started to happen. I fixed it specifying the type for the generic class.
Example:
class Base<T> {
void foo(T t) {}
}
Object was being instantiated like this:
def base = new Base() {
@Override
void foo(String string) {}
}
Fixed specifying the type for the generic class:
def base = new Base<String>() {
@Override
void foo(String string) {}
}
Also, if you are having problems with @Override
, check if the version doesn't have this bug.