overloadinvokemethodbug.groovy
来自「大名鼎鼎的java动态脚本语言。已经通过了sun的认证」· GROOVY 代码 · 共 31 行
GROOVY
31 行
/** * @version $Revision: 1.7 $ */ class OverloadInvokeMethodBug extends GroovyTestCase { void testBug() { def a = new OverloadA() a.duh() def b = new OverloadB() b.duh() }}class OverloadA { def invokeMethod(String name, Object args) { try { metaClass.invokeMethod(this, name, args) } catch(MissingMethodException e) { println "Missing method: ${name}" } } }class OverloadB extends OverloadA {}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?