GROOVY-6582 : Script.invokeMethod bypasses getProperty when looking for closure-valued properties. Make sure that getProperty and invokeMethod are consistent.
()
| 58 | * Make sure that getProperty and invokeMethod are consistent. |
| 59 | */ |
| 60 | @Test |
| 61 | void testBaseScript() { |
| 62 | String script = "" + |
| 63 | "abstract class DeclaredBaseScript extends Script {\n" + |
| 64 | " def v = { it * 2 }\n" + |
| 65 | " def z = { it * 3 }\n" + |
| 66 | " def getProperty(String n) { n == 'c' ? v : super.getProperty(n) }\n" + |
| 67 | "}\n" + |
| 68 | "@groovy.transform.BaseScript DeclaredBaseScript baseScript\n" + |
| 69 | "assert c(2) == 4\n" + |
| 70 | "assert z(2) == 6"; |
| 71 | |
| 72 | GroovyShell shell = new GroovyShell(); |
| 73 | shell.evaluate(script); |
| 74 | } |
| 75 | |
| 76 | // GROOVY-6344 |
| 77 | @Test |