Eric Milles created GROOVY-10376:
------------------------------------

             Summary: Consider supporting property syntax for variadic "getter" 
methods
                 Key: GROOVY-10376
                 URL: https://issues.apache.org/jira/browse/GROOVY-10376
             Project: Groovy
          Issue Type: Improvement
            Reporter: Eric Milles


Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
class C {
  def getFoo(String[] strings) {
  }
  void test() {
    getFoo()
    foo
  }
}

@groovy.transform.TypeChecked
void test(Class<?> type) {
  type.getDeclaredConstructor().newInstance() // 
getDeclaredConstructor(Class...)
  type.declaredConstructor.newInstance()
}
{code}

Since "getFoo" can be called with zero arguments, does that make it a candidate 
for supporting property syntax?  I submit this for consideration.

We have style checks that suggest property syntax when "getName()" is 
encountered.  But this case cannot be converted and so we must live with a 
warning or add an exclusion.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to