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 declaring the field and property with same name
Date Wed, 12 Jul 2017 16:11:51 GMT


On 12.07.2017 17:48, Daniel Sun wrote:
> Hi all,
>
>         If no one is opposed to deprecating the weird feature, I'll modify
> the two tests at the weekend(shouldCompile -> shouldNotCompile):
>
> https://github.com/apache/groovy/blob/master/src/test/gls/scope/MultipleDefinitionOfSameVariableTest.groovy#L110
>
> https://github.com/apache/groovy/blob/master/src/test/gls/scope/MultipleDefinitionOfSameVariableTest.groovy#L119
>

sorry, but veto.

class X {
   String foo
   private foo
}

declares for example a get/setFoo for String, while the backing field is 
Object. The field also allows you to use additional modifiers like 
volatile for example.

bye Jochen

Mime
View raw message