⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 methodpointerbug.groovy

📁 大名鼎鼎的java动态脚本语言。已经通过了sun的认证
💻 GROOVY
字号:
package groovy.bugs/** * @author Pilho Kim * @version $Revision: 1.4 $ */class MethodPointerBug extends GroovyTestCase {    def void sayHello() {         println "hello"     }     def MethodPointerBug getThisObject() {         return this    }     // Test a standard method pointer operator ".&".  For example, foo.&bar.    void testMethodPointer() {        def bug = new MethodPointerBug()        def x = bug.&sayHello        x()    }     // Test a standard method pointer operator ".&" with this object.  For example, this.&bar.    void testThisMethodPointer() {        def y = this.&sayHello        y()    }     ///////////////////////////////////////////////////////////////////////////////////////////    // Test a default method pointer operator "&" with this object.  For example, &bar.    // This shows that the issue GROOVY-826 has been fixed in groovy-1.0-jar-02./*  todo - commented out due to groovy.g non-determinisms    void testDefaultMethodPointer() {        def z = &sayHello        z()    } */    // Test a default method pointer operator ".&" with returned object.  For example, someMethod().&bar.    void testMethodPointerWithReturn() {        def u = getThisObject().&sayHello        u()        def v = thisObject.&sayHello        v()    } }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -