Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A8A03200BD5 for ; Thu, 8 Dec 2016 23:34:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A73F2160B1F; Thu, 8 Dec 2016 22:34:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C963A160B0A for ; Thu, 8 Dec 2016 23:34:48 +0100 (CET) Received: (qmail 15561 invoked by uid 500); 8 Dec 2016 22:34:48 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 15551 invoked by uid 99); 8 Dec 2016 22:34:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2016 22:34:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 52C3A1A9971 for ; Thu, 8 Dec 2016 22:34:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 5.573 X-Spam-Level: ***** X-Spam-Status: No, score=5.573 tagged_above=-999 required=6.31 tests=[FORGED_HOTMAIL_RCVD2=1.187, HTML_MESSAGE=2, KAM_UNSUB1=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_SOFTFAIL=0.972, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id kKQaMDMY_-Md for ; Thu, 8 Dec 2016 22:34:45 +0000 (UTC) Received: from mbob.nabble.com (mbob.nabble.com [162.253.133.15]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 2F99E5F1AE for ; Thu, 8 Dec 2016 22:34:45 +0000 (UTC) Received: from static.162.255.23.22.macminivault.com (unknown [162.255.23.22]) by mbob.nabble.com (Postfix) with ESMTP id 019FF3798E55 for ; Thu, 8 Dec 2016 14:22:06 -0800 (PST) Date: Thu, 8 Dec 2016 15:34:43 -0700 (MST) From: Daniel Sun To: dev@groovy.incubator.apache.org Message-ID: In-Reply-To: <1615947057.1723299.1481229480316.JavaMail.zimbra@u-pem.fr> References: <1481218814004-5737154.post@n5.nabble.com> <1615947057.1723299.1481229480316.JavaMail.zimbra@u-pem.fr> Subject: Re: Default Method for Groovy 3 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_107259_2067726241.1481236483861" archived-at: Thu, 08 Dec 2016 22:34:49 -0000 ------=_Part_107259_2067726241.1481236483861 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi R=C3=A9mi, As to the "default" modifier, we have to wait for the release of newer= ASM to support it ;) Thanks for your reminding. Cheers, Daniel.Sun =E5=9C=A8 "Remi Forax [via Groovy]" =EF=BC=8C2016=E5=B9=B412=E6=9C=889=E6=97=A5 =E4=B8=8A=E5=8D=884:38=E5=86= =99=E9=81=93=EF=BC=9A Hi Daniel, as you have discovered, there is no flag for specifying a default method in= the JVM spec, hence no ACC_DEFAULT flag in ASM, a default method is just a non abstract method in an interface. Also default and static methods in interface can be either public or privat= e. cheers, R=C3=A9mi ----- Mail original ----- > De: "Daniel Sun" <[hidden email]> > =C3=80: [hidden email] > Envoy=C3=A9: Jeudi 8 D=C3=A9cembre 2016 18:40:14 > Objet: Default Method for Groovy 3 > 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/commit/89f45ac86e7945ef812= 83697b6ed9018e997a045 > ). 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 =3D new Person() > assert 'hello, Daniel' =3D=3D "${p.hello()}, ${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. ________________________________ If you reply to this email, your message will be added to the discussion be= low: http://groovy.329449.n5.nabble.com/Default-Method-for-Groovy-3-tp5737154p57= 37158.html To unsubscribe from Default Method for Groovy 3, click here. NAML -- View this message in context: http://groovy.329449.n5.nabble.com/Default-Me= thod-for-Groovy-3-tp5737154p5737161.html Sent from the Groovy Dev mailing list archive at Nabble.com. ------=_Part_107259_2067726241.1481236483861 Content-Type: text/html; charset=UTF8 Content-Transfer-Encoding: quoted-printable
Hi R=C3=A9mi,

     As to the "default" mod= ifier, we have to wait for the release of newer ASM to support it ;)

      Thanks for your reminding.<= br>

Cheers,
Daniel.Sun




=E5=9C=A8 "Remi Forax [via Groovy]" &l= t;ml-node+[hidden email]= >=EF=BC=8C2016=E5=B9=B412=E6=9C=889=E6=97=A5 =E4=B8=8A=E5=8D=884:38=E5= =86=99=E9=81=93=EF=BC=9A

Hi Daniel,
as you have discovered, there is no flag for specifying a default method in= the JVM spec, hence no ACC_DEFAULT flag in ASM,
a default method is just a non abstract method in an interface.

Also default and static methods in interface can be either public or privat= e.

cheers,
R=C3=A9mi

----- Mail original -----
> De: "Daniel Sun" <[hidden email]>
> =C3=80: [hidden email]
> Envoy=C3=A9: Jeudi 8 D=C3=A9cembre 2016 18:40:14
> Objet: Default Method for Groovy 3

> Hi all,
>
>         The new parser(Parrot) supports default me= thod now. You can find
> the new feature at  the enhancedInterface branch of groovy-parser= project
> <https:= //github.com/danielsun1106/groovy-parser/tree/enhancedInterface> &nb= sp;(
> https://github.com/danielsun1106/groovy-parser/commit/89f45ac86e7945ef81283= 697b6ed9018e997a045
> ). If no problem with the implementation, I'll merge it into the maste= r
> 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 =3D new Person()
> assert 'hello, Daniel' =3D=3D "${p.hello()}, ${p.name()}" >
>      *Another more complicated example can be found at:= *
> https://github.com/danielsun1106/groovy-parser/blob/enhancedInterface/src/t= est/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.ht= ml
> Sent from the Groovy Dev mailing list archive at Nabble.com.



If you reply to this email, your message wi= ll be added to the discussion below:
http://groovy.329449.n5.nabble.com/Default-Method-for-Groovy-3-tp5737154p5= 737158.html
To unsubscribe from Default Method for Groovy 3, click here.
NAML
=09 =09 =09

View this message in context: Re: Default Method for= Groovy 3
Sent from the Groovy Dev mailing list archive at Nabble.com.
------=_Part_107259_2067726241.1481236483861--