From notifications-return-11971-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Wed Apr 25 13:59:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 0C2B1180679 for ; Wed, 25 Apr 2018 13:59:03 +0200 (CEST) Received: (qmail 56082 invoked by uid 500); 25 Apr 2018 11:59:03 -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 56070 invoked by uid 99); 25 Apr 2018 11:59:03 -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; Wed, 25 Apr 2018 11:59:03 +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 80B381A2442 for ; Wed, 25 Apr 2018 11:59:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -102.311 X-Spam-Level: X-Spam-Status: No, score=-102.311 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id y4HaWdELeYXM for ; Wed, 25 Apr 2018 11:59:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 461AD5FBB9 for ; Wed, 25 Apr 2018 11:59: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 C1824E0F1C for ; Wed, 25 Apr 2018 11:59: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 6F5D5241C7 for ; Wed, 25 Apr 2018 11:59:00 +0000 (UTC) Date: Wed, 25 Apr 2018 11:59:00 +0000 (UTC) From: "Paul King (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (GROOVY-8559) CLONE - Add @Repeatable java8 annotation support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GROOVY-8559?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King updated GROOVY-8559: ------------------------------ Description: I cloned the issue to fix another case. For the case of pre-compiled Java annotations, a check in {{ResolveVisitor#visitAnnotations}} is triggering an error prior to the auto-collecting of annotations code being handled in {{ExtendedVerifier}}. was: 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 = "val1") @MyAnnotation(value = "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 = "val1") @MyAnnotation(value = "val2") void annotatedMethod() { println("annotated method called") } {code} The full groovy script to reproduce problem is below. It throws exception: {color:red}java.lang.annotation.AnnotationFormatError: Duplicate annotation for class: interface MyAnnotation: @MyAnnotation(value=val2){color} at line `List annos = m.getAnnotations()` {code} import java.lang.annotation.* class MyClass { @MyAnnotation(value = "val1") @MyAnnotation(value = "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 = new MyClass() ob.annotatedMethod() java.lang.reflect.Method m = ob.getClass().getMethod("annotatedMethod") List annos = m.getAnnotations() println("annos = $annos") } } @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Repeatable(MyAnnotationArray) public @interface MyAnnotation { String value() default "val0"; } @Retention(RetentionPolicy.RUNTIME) public @interface MyAnnotationArray { MyAnnotation[] value() } {code} > CLONE - Add @Repeatable java8 annotation support > ------------------------------------------------ > > Key: GROOVY-8559 > URL: https://issues.apache.org/jira/browse/GROOVY-8559 > Project: Groovy > Issue Type: New Feature > Affects Versions: 2.5.0-rc-1 > Environment: groovy 2.4.11 > Reporter: Dmitry Lukyanov > Assignee: Paul King > Priority: Major > Fix For: 2.5.0-beta-2 > > > I cloned the issue to fix another case. For the case of pre-compiled Java annotations, a check in {{ResolveVisitor#visitAnnotations}} is triggering an error prior to the auto-collecting of annotations code being handled in {{ExtendedVerifier}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)