Hi Daniel,
would the following case work:
class Goo {  @Lazy static final Goo instance = new Goo(...)  static getGOO() { 
instance } // return type deduced to be Goo ?}
Cheers,mg
-------- Ursprüngliche Nachricht --------Von: Daniel Sun 
<[email protected]> Datum: 05.09.18  06:49  (GMT+01:00) An: 
[email protected] Betreff: About type inference of method return 
value 
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

Reply via email to