Since two
and doIt
declared in the same class, groovy will skip the meta object protocol for this call. You can override this behavior by marking the superclass as GroovyInterceptable
, which causes all method calls to go through invokeMethod
. For instance:
class A implements GroovyInterceptable { def doIt(){ two() println 'do it!' } protected two(){ println 'two' } } class B extends A { def doLast(){ doIt() } } B b = new B() b.doIt()
source share