groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: About the syntheticPublic property of member method node in class
Date Fri, 01 Apr 2016 16:02:18 GMT

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

Mime
View raw message