方法中 , 不能调用 invokeMethod 方法 , 这样调用肯定会出现无限循环递归 , 导致栈溢出 ;
此处只能通过调用 MetaClass#invokeMethod 方法 , 调用相关函数 ;...通过元类对象的 invokeMethod 方法 , 不会导致栈溢出 ;
获取该 Groovy 类的 metaClass , 然后调用 metaClass 的 invokeMethod 方法 , 传入调用对象...(this, "respondsTo", name, args)
传入了的方法名 , 如果存在 , 则直接通过 metaClass.invokeMethod 调用该方法 ;
// 如果定义了该方法...invokeMethod 方法
肯定会出现递归调用 , 导致栈溢出
只能通过调用 MetaClass#invokeMethod 方法 , 调用相关函数...hello 方法
student.hello()
// 调用不存在的方法 , 也会触发 invokeMethod 方法
student.hello1()
// 通过 GroovyObject#invokeMethod