Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 58AA9200CB2 for ; Sun, 25 Jun 2017 14:00:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 57792160BE0; Sun, 25 Jun 2017 12:00:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9D59D160BD8 for ; Sun, 25 Jun 2017 14:00:05 +0200 (CEST) Received: (qmail 62046 invoked by uid 500); 25 Jun 2017 12:00:04 -0000 Mailing-List: contact notifications-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list notifications@groovy.apache.org Received: (qmail 62037 invoked by uid 99); 25 Jun 2017 12:00:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Jun 2017 12:00:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E9C4A1A011C for ; Sun, 25 Jun 2017 12:00:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id EbtI9yzo2_ta for ; Sun, 25 Jun 2017 12:00:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 7A7375FB7F for ; Sun, 25 Jun 2017 12:00:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A8934E0711 for ; Sun, 25 Jun 2017 12:00:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3B815240B7 for ; Sun, 25 Jun 2017 12:00:00 +0000 (UTC) Date: Sun, 25 Jun 2017 12:00:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-8236) Report more meaningful error for versions of Groovy not supporting @Repeatable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 25 Jun 2017 12:00:06 -0000 [ https://issues.apache.org/jira/browse/GROOVY-8236?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D160= 62306#comment-16062306 ]=20 ASF GitHub Bot commented on GROOVY-8236: ---------------------------------------- GitHub user paulk-asert opened a pull request: https://github.com/apache/groovy/pull/565 GROOVY-8236: Report more meaningful error for versions of Groovy not = =E2=80=A6 =E2=80=A6supporting @Repeatable You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/groovy groovy8236 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/565.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #565 =20 ---- commit b3a0e1634749dbd703f705795a767b71c11a7bec Author: paulk Date: 2017-06-25T11:57:36Z GROOVY-8236: Report more meaningful error for versions of Groovy not su= pporting @Repeatable ---- > Report more meaningful error for versions of Groovy not supporting @Repea= table > -------------------------------------------------------------------------= ----- > > Key: GROOVY-8236 > URL: https://issues.apache.org/jira/browse/GROOVY-8236 > Project: Groovy > Issue Type: New Feature > Environment: groovy 2.4.11 > Reporter: Dmitry Lukyanov > > I cloned the issue. As well as providing support for @Repeatable, we shou= ld give a more meaningful error message for any streams of Groovy where we = don't support it. I'd guess supported (2.5.0), unsupported (2.4.x); but in = any case, this issue is to handle the unsupported case. > Instead of: > {noformat} > java.lang.annotation.AnnotationFormatError ... > {noformat} > We could have something like: > {noformat} > Annotation @MyAnnotation has RUNTIME retention and 2 occurrences. > Automatic repeated annotations are not allowed in this version of Groovy. > Consider explicitly adding the @MyAnnotationArray collector annotation. > {noformat} > ---- original description ----- > raised on stackoverflow: https://stackoverflow.com/questions/44532632/is-= the-repeatable-annotation-not-supported-by-groovy/44628119#44628119 > Problem: the following code in groovy 2.4.11 / java8 > {code} > @MyAnnotation(value =3D "val1") > @MyAnnotation(value =3D "val2") > void annotatedMethod() { println("annotated method called") } > {code} > should be compiled to this: > {code} > @MyAnnotationArray({@MyAnnotation("val1"), @MyAnnotation("val2")}) > void annotatedMethod() { println("annotated method called") } > {code} > but actually compiled to this: > {code} > @MyAnnotation(value =3D "val1") > @MyAnnotation(value =3D "val2") > void annotatedMethod() { println("annotated method called") } > {code} > The full groovy script to reproduce problem is below. > It throws exception:=20 > {color:red}java.lang.annotation.AnnotationFormatError: Duplicate annotati= on for class: interface MyAnnotation: @MyAnnotation(value=3Dval2){color} > at line `List annos =3D m.getAnnotations()` > {code} > import java.lang.annotation.* > class MyClass=20 > { > @MyAnnotation(value =3D "val1") > @MyAnnotation(value =3D "val2") > //change annotation to next line and the code will work > //@MyAnnotationArray( [@MyAnnotation("val1"), @MyAnnotation("val2")] = ) > public void annotatedMethod() > { > System.out.println("annotated method called"); > } > public static void main(String... args) > { > MyClass ob =3D new MyClass() > ob.annotatedMethod() > java.lang.reflect.Method m =3D ob.getClass().getMethod("annotatedMe= thod") > List annos =3D m.getAnnotations() > println("annos =3D $annos") > } > } > @Target(ElementType.METHOD) > @Retention(RetentionPolicy.RUNTIME) > @Repeatable(MyAnnotationArray)=20 > public @interface MyAnnotation > { > String value() default "val0"; > } > @Retention(RetentionPolicy.RUNTIME) > public @interface MyAnnotationArray=20 > { > MyAnnotation[] value() > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)