You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/11/03 18:31:00 UTC
[jira] [Assigned] (GROOVY-8214) Implicit .call is inconsistent
[ https://issues.apache.org/jira/browse/GROOVY-8214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-8214:
-----------------------------------
Assignee: Eric Milles
> Implicit .call is inconsistent
> ------------------------------
>
> Key: GROOVY-8214
> URL: https://issues.apache.org/jira/browse/GROOVY-8214
> Project: Groovy
> Issue Type: Bug
> Reporter: Daniil Ovchinnikov
> Assignee: Eric Milles
> Priority: Major
>
> {code}
> interface Callable {
> def call()
> }
> def callable = new Callable() {
> def call() { println "callable local var" }
> }
> callable.call()
> callable()
> class ClassWithCallableField {
> public ppp = new Callable() {
> def call() { println "callable field" }
> }
> }
> def cwcp = new ClassWithCallableField()
> cwcp.ppp.call()
> cwcp.ppp() // MME
> def foo(Callable p) {
> p.call()
> p()
> }
> foo new Callable() {
> def call() { println "callable parameter" }
> }
> class ClassWithCallableGetter {
> def getGetter() {
> new Callable() {
> def call() { println "callable getter" }
> }
> }
> }
> def cwcg = new ClassWithCallableGetter()
> cwcg.getter.call()
> cwcg.getter() // MME
> class ClassWithCallableFieldInside {
> public bbb = new Callable() {
> def call() { println "callable field inside class" }
> }
> def foo() {
> bbb.call()
> bbb()
> }
> }
> new ClassWithCallableFieldInside().foo()
> class ClassWithCallableGetterInside {
> def getGetter() {
> new Callable() {
> def call() { println "callable getter inside class" }
> }
> }
> def foo() {
> getter.call()
> getter() // MME
> }
> }
> new ClassWithCallableGetterInside().foo()
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)