You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/07/20 23:19:00 UTC
[jira] [Commented] (GROOVY-11432) Support method references/method pointers in annotations
[ https://issues.apache.org/jira/browse/GROOVY-11432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867561#comment-17867561 ]
ASF GitHub Bot commented on GROOVY-11432:
-----------------------------------------
paulk-asert commented on PR #2097:
URL: https://github.com/apache/groovy/pull/2097#issuecomment-2241329543
**Update**: the current PR now uses `withMethodClosure` instead of the previous version which used `with`. This means that it works with static compilation and static type checking.
> Support method references/method pointers in annotations
> --------------------------------------------------------
>
> Key: GROOVY-11432
> URL: https://issues.apache.org/jira/browse/GROOVY-11432
> Project: Groovy
> Issue Type: Improvement
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
>
> The topic (for Java) appeared on social media recently:
> https://twitter.com/GeoffreyDeSmet/status/1808216150867861896
> Java thought it might be a good idea a while back but thought it would be hard to implement:
> https://mail.openjdk.org/pipermail/core-libs-dev/2018-November/056596.html
> For us we could use a Class typed annotation attribute and do like we currently do for closures, e.g.:
> {code}
> @interface UIColorAnnotation {
> Class method()
> }
> @UIColorAnnotation(method = Person::getAgeColor)
> public int getAge() {
> }
> ...
> {code}
> Since we already support closures, my thinking is to make the above exactly equivalent to:
> {code}
> @UIColorAnnotation(method = { with(Person::getAgeColor) })
> public int getAge() {
> }
> ...
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)