groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <realblue...@hotmail.com>
Subject About type inference of method return value
Date Wed, 05 Sep 2018 04:49:56 GMT
Hi all,

      I am going to refine the type inference of method return value, the
methods should match one of the following charactristics:
1) `final`
2) `private`
3) `static`
4)  method defined in Script

      The above methods will not be overrided and have exact method return
type.  

      Any thoughts?

      P.S. Currently the following code will fail to compile, but it's
obiviously valid.
```
@groovy.transform.CompileStatic
class Test {
    static m() {
        return 'abc'
    }
    
    static a() {
        return m().length()
    }
    
    static void main(String[] args) {
        assert 3 == a()
    }
}
```

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Mime
View raw message