You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by daniel_sun <re...@hotmail.com> on 2016/04/01 17:50:23 UTC

About the syntheticPublic property of member method node in class

Hi List,

      The following code is copied from GinA2, which we use to test the new
parser for Groovy.

class Book {
    private String title
    Book (String theTitle) {
        title = theTitle
    }
    String getTitle(){
        return title
    }
}

      I have a question about the syntheticPublic of "getTitle" method node,
which has no visibility modifier(e.g. public, protected, private), so I
think its "public" should be synthetic and expect syntheticPublic  is true,
but the old parser of Groovy set syntheticPublic  as false.  (related issue
url: https://github.com/jespersm/groovy/issues/19).

     Can you tell me the rationale about syntheticPublic and synthetic of
MethodNode?

 Thanks in advance,
Daniel.Sun





--
View this message in context: http://groovy.329449.n5.nabble.com/About-the-syntheticPublic-property-of-member-method-node-in-class-tp5732142.html
Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: About the syntheticPublic property of member method node in class

Posted by Jochen Theodorou <bl...@gmx.org>.
On 01.04.2016 21:08, Remi Forax wrote:
[...]
> What about, methods generated by the compiler because they are needed by the VM, they cary no metadata for the compiler, that why they are ignored by the compiler.
>
> There is no flag for method synthetized by the compiler but visible by the compiler (see [1] for more info).
[...]
> [1] http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.8

yes, the flag is lacking.... on the other hand, it does not really 
bother me since I go by "invisible in an IDE".


bye Jochen


Re: About the syntheticPublic property of member method node in class

Posted by Remi Forax <fo...@univ-mlv.fr>.

----- Mail original -----
> De: "Jochen Theodorou" <bl...@gmx.org>
> À: dev@groovy.apache.org
> Envoyé: Vendredi 1 Avril 2016 18:02:18
> Objet: Re: About the syntheticPublic property of member method node in class
> 
> 
> On 01.04.2016 17:50, daniel_sun wrote:
> > Hi List,
> >
> >        The following code is copied from GinA2, which we use to test the
> >        new
> > parser for Groovy.
> >
> > class Book {
> >      private String title
> >      Book (String theTitle) {
> >          title = theTitle
> >      }
> >      String getTitle(){
> >          return title
> >      }
> > }
> >
> >        I have a question about the syntheticPublic of "getTitle" method
> >        node,
> > which has no visibility modifier(e.g. public, protected, private), so I
> > think its "public" should be synthetic and expect syntheticPublic  is true,
> > but the old parser of Groovy set syntheticPublic  as false.  (related issue
> > url: https://github.com/jespersm/groovy/issues/19).
> >
> >       Can you tell me the rationale about syntheticPublic and synthetic of
> > MethodNode?
> 
> If you set those bean property methods to synthetic, IDEs will not offer
> them anymore in auto-completion. I too was of the opinion synthetic
> means "added by the compiler", but I see it now more as a "internal
> method, not for the user".

What about, methods generated by the compiler because they are needed by the VM, they cary no metadata for the compiler, that why they are ignored by the compiler.

There is no flag for method synthetized by the compiler but visible by the compiler (see [1] for more info).

> So all those mop methods we have/had or
> rightfully synthetic, but bean methods like the setTitle one above does
> not fall in this second category. getTitle is a method added by the user
> and user-added methods should never be synthetic. And yes, no visibility
> modifier means public.
> 
> bye Jochen
> 

cheers,
Rémi

[1] http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.8

Re: About the syntheticPublic property of member method node in class

Posted by daniel_sun <re...@hotmail.com>.
I've fixed the issue in the new parser. Thanks for your help, Jochen :)



在 "Jochen Theodorou [via Groovy]" <ml...@n5.nabble.com>,2016年4月2日 上午12:02写道:

On 01.04.2016 17:50, daniel_sun wrote:

> Hi List,
>
>        The following code is copied from GinA2, which we use to test the new
> parser for Groovy.
>
> class Book {
>      private String title
>      Book (String theTitle) {
>          title = theTitle
>      }
>      String getTitle(){
>          return title
>      }
> }
>
>        I have a question about the syntheticPublic of "getTitle" method node,
> which has no visibility modifier(e.g. public, protected, private), so I
> think its "public" should be synthetic and expect syntheticPublic  is true,
> but the old parser of Groovy set syntheticPublic  as false.  (related issue
> url: https://github.com/jespersm/groovy/issues/19).
>
>       Can you tell me the rationale about syntheticPublic and synthetic of
> MethodNode?

If you set those bean property methods to synthetic, IDEs will not offer
them anymore in auto-completion. I too was of the opinion synthetic
means "added by the compiler", but I see it now more as a "internal
method, not for the user". So all those mop methods we have/had or
rightfully synthetic, but bean methods like the setTitle one above does
not fall in this second category. getTitle is a method added by the user
and user-added methods should never be synthetic. And yes, no visibility
modifier means public.

bye Jochen


________________________________
If you reply to this email, your message will be added to the discussion below:
http://groovy.329449.n5.nabble.com/About-the-syntheticPublic-property-of-member-method-node-in-class-tp5732142p5732143.html
To unsubscribe from About the syntheticPublic property of member method node in class, click here<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5732142&code=cmVhbGJsdWVzdW5AaG90bWFpbC5jb218NTczMjE0MnwxMTQ2MjE4MjI1>.
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/About-the-syntheticPublic-property-of-member-method-node-in-class-tp5732142p5732151.html
Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: About the syntheticPublic property of member method node in class

Posted by Jochen Theodorou <bl...@gmx.org>.
On 01.04.2016 17:50, daniel_sun wrote:
> Hi List,
>
>        The following code is copied from GinA2, which we use to test the new
> parser for Groovy.
>
> class Book {
>      private String title
>      Book (String theTitle) {
>          title = theTitle
>      }
>      String getTitle(){
>          return title
>      }
> }
>
>        I have a question about the syntheticPublic of "getTitle" method node,
> which has no visibility modifier(e.g. public, protected, private), so I
> think its "public" should be synthetic and expect syntheticPublic  is true,
> but the old parser of Groovy set syntheticPublic  as false.  (related issue
> url: https://github.com/jespersm/groovy/issues/19).
>
>       Can you tell me the rationale about syntheticPublic and synthetic of
> MethodNode?

If you set those bean property methods to synthetic, IDEs will not offer 
them anymore in auto-completion. I too was of the opinion synthetic 
means "added by the compiler", but I see it now more as a "internal 
method, not for the user". So all those mop methods we have/had or 
rightfully synthetic, but bean methods like the setTitle one above does 
not fall in this second category. getTitle is a method added by the user 
and user-added methods should never be synthetic. And yes, no visibility 
modifier means public.

bye Jochen