groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <realblue...@hotmail.com>
Subject Re: Default Method for Groovy 3
Date Thu, 08 Dec 2016 23:35:50 GMT
Thanks ;)



在 "Guillaume Laforge [via Groovy]" <ml-node+s329449n5737156h94@n5.nabble.com>,2016年12月9日
上午2:21写道:

Awesome!

On Thu, Dec 8, 2016 at 6:40 PM, Daniel Sun <[hidden email]> wrote:
Hi all,

         The new parser(Parrot) supports default method now. You can find
the new feature at  the enhancedInterface branch of groovy-parser project
<https://github.com/danielsun1106/groovy-parser/tree/enhancedInterface>  (
https://github.com/danielsun1106/groovy-parser/commit/89f45ac86e7945ef81283697b6ed9018e997a045
). If no problem with the implementation, I'll merge it into the master
later.

*Here is an example:*

interface Greetable {
    String name();
    default String hello() {
        return 'hello'
    }
}

class Person implements Greetable {
    @Override
    public String name() {
        return 'Daniel'
    }
}

def p = new Person()
assert 'hello, Daniel' == "${p.hello()}, ${p.name<http://p.name>()}"

      *Another more complicated example can be found at:*
https://github.com/danielsun1106/groovy-parser/blob/enhancedInterface/src/test/resources/core/DefaultMethod_02x.groovy


Cheers,
Daniel.Sun




--
View this message in context: http://groovy.329449.n5.nabble.com/Default-Method-for-Groovy-3-tp5737154.html
Sent from the Groovy Dev mailing list archive at Nabble.com.



--
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Social: @glaforge<http://twitter.com/glaforge> / Google+<https://plus.google.com/u/0/114130972232398734985/posts>


________________________________
If you reply to this email, your message will be added to the discussion below:
http://groovy.329449.n5.nabble.com/Default-Method-for-Groovy-3-tp5737154p5737156.html
To unsubscribe from Default Method for Groovy 3, click here<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5737154&code=cmVhbGJsdWVzdW5AaG90bWFpbC5jb218NTczNzE1NHwxMTQ2MjE4MjI1>.
NAML<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://groovy.329449.n5.nabble.com/Default-Method-for-Groovy-3-tp5737154p5737164.html
Sent from the Groovy Dev mailing list archive at Nabble.com.
Mime
View raw message