Details
-
Wish
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
This is just a throwaway idea related to named and optional parameters.
Groovyc could emit synthetic metadata for the names of parameters.
This would provide support for named parameters to methods, or just improved IDE functionality.
@parameter-names (
{"what", "target"})
doItNow(what, target {
....
}
For methods with default parameters, we could also mark which methods are synthetic and a preview of what the value is. This would allow a smart enough IDE to fold these methods back into a single method and show the default values in the signature.
doSomething(a, b = 'defB', c = 'defC') {
}
The above groovy method would create multiple methods with synthetic metadata.
@parameter-names (
{"a", "b", "c"})
Object doSomething(Object a, Object b, Object c) {
...
}
@parameter-names (
{"a"})
@default-parameters {
concrete-method = "Object doSomething(Object a, Object b, Object c)",
defaults (
)
}
Object doSomething(Object a) {
// synthetic method
}