You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/11/19 16:53:00 UTC
[jira] [Created] (GROOVY-10376) Consider supporting property syntax for variadic "getter" methods
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)