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 19C23200CFE for ; Fri, 8 Sep 2017 15:05:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1865E1609BF; Fri, 8 Sep 2017 13:05: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 10FBA1609DA for ; Fri, 8 Sep 2017 15:05:04 +0200 (CEST) Received: (qmail 6292 invoked by uid 500); 8 Sep 2017 13:05:03 -0000 Mailing-List: contact dev-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 dev@groovy.apache.org Received: (qmail 6269 invoked by uid 99); 8 Sep 2017 13:05:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Sep 2017 13:05:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 5C15DC7AE9 for ; Fri, 8 Sep 2017 13:05:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id QVxAfenm4ZX0 for ; Fri, 8 Sep 2017 13:05:00 +0000 (UTC) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id A6A505FBB1 for ; Fri, 8 Sep 2017 13:04:59 +0000 (UTC) Received: by mail-lf0-f45.google.com with SMTP id 80so5529060lfy.4 for ; Fri, 08 Sep 2017 06:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=psnS+qOWoHF9xYuTLKEZTvDmDJWFfGQj4eK1VgZk5V0=; b=b14f5RYBjGI/mei8VhVAccc914UUUpPlY/YzzzZ1CXRT3ImXMuFgkR+nwGiIgDd7d4 zu2sEe3Vh7I/QKAo8V6UblqsdgqvKdXFgttw5Nhr41/Ne4XXqbvbC6xJhljciApaFCTq tUOAAKNZrzs3staPzTjAddqFB9v1qfhTCx3rj2EVzuFCDuJOYluZQLTtDIERBMxTKTT2 iwkorBaT7j5MYFCI1Ce5y1uW9qpKmeCEiH//DfkUJyNgu/Ih3FbjgQHbqC9c+eCT5k/B vycMJWmR28hwCaH+Mlia9somqj6h5Mp2U8QVVx9ctMitBVTGHJlVKwLoUn54S2RkRM7i N3iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=psnS+qOWoHF9xYuTLKEZTvDmDJWFfGQj4eK1VgZk5V0=; b=PhoGVNt4T4xVnStGVvQZg9vC+Ass3WxezF5Bk3WhuoV1Z7ccZ+eLV9IzYlclREZuCf nwSn09d3wyOBckYk8NYc8u/Qxeqhda0RpCOriDnx3gxk5h4LXFVAWCVjq8oQRB2fYzhy KSIc6G0EW8hjbDjHo9y8lIRRSekTavZwYanhrYWKVgET3nS8k14J9oeS/DbBYawELp8I rjPjZ2tIAcY5bfPViuj8UbzjO9MCEFomHTNTRulqDszGCyi0a7V5VjpADqM+wyZDXxH2 kr7tOk1OFnrAIGns+dnT1TcABYZDZJUf93/gbtt7YOlZoOjOCGMdYJVmcpz+PLcSowvP 2urg== X-Gm-Message-State: AHPjjUiPWfTzMPiVM6RiCtTN+0i6LdhEgv+EyX/N8mINY3t+looI2BPB 1gpilmQOnAkuaViCUJRdC105UUl/VA== X-Google-Smtp-Source: ADKCNb5qIceTcQh+4PeI5YKX6VeH1HMdMMHuYkP1nIHXXaKix2Wj5sceUCT4vsyxyrxN/VlbPcnsRK3eyaGuAt2kjhI= X-Received: by 10.46.20.15 with SMTP id u15mr762724ljd.39.1504875898599; Fri, 08 Sep 2017 06:04:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.170.211 with HTTP; Fri, 8 Sep 2017 06:04:57 -0700 (PDT) In-Reply-To: <1116949062.2563601.1504875627771.JavaMail.zimbra@u-pem.fr> References: <1116949062.2563601.1504875627771.JavaMail.zimbra@u-pem.fr> From: Andres Almiray Date: Fri, 8 Sep 2017 15:04:57 +0200 Message-ID: Subject: Re: Groovy and code coverage To: dev@groovy.apache.org Content-Type: multipart/alternative; boundary="f403045fc0745e00650558ad398a" archived-at: Fri, 08 Sep 2017 13:05:06 -0000 --f403045fc0745e00650558ad398a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Unfortunately that annotation is coming in JDK9. We'll need something that can be used with JDK7 an upwards. ------------------------------------------- Java Champion; Groovy Enthusiast http://andresalmiray.com http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. On Fri, Sep 8, 2017 at 3:00 PM, Remi Forax wrote: > A standard annotation for generated code was added in Java 9: > http://download.java.net/java/jdk9/docs/api/javax/annotation/processing/ > Generated.html > > R=C3=A9mi > > ------------------------------ > > *De: *"Andres Almiray" > *=C3=80: *dev@groovy.apache.org > *Envoy=C3=A9: *Vendredi 8 Septembre 2017 11:41:18 > *Objet: *Groovy and code coverage > > Hello everyone, > > As you may be aware there are only a few choices in the Java pace that ca= n > be used for code coverage, JaCoCo being the one that gives the most > accurate results. While it's easy to setup JaCoco for Groovy sources ther= e > are times where the tool reports no coverage for some lines of code that > should not have been counted for coverage in the first case, these are so= me > of the methods coming from GroovyObject and AST transformations, > specifically `getProperty`, `setProperty`, `getMetaClass`, and > `invokeMethod`. > > I had a chat with Marc Hoffmann yesterday about this situation, which is = a > topic we've discussed a few times in the past. I've got some good news, > Groovy is not alone in this problem, the Lombok project has suffered the > same fate which has prompted them to seek a solution. The alternative the= y > came up with is to have Lombok identified generated code that should not = be > covered with a special annotation (@lombok.Generated), JaCoCo has a > filtering feature (not yet public) that can identify elements annotated > with said annotation and skip them from coverage reports. See > > https://projectlombok.org/api/index.html?lombok/Generated.html > https://github.com/jacoco/jacoco/pull/513 > https://github.com/jacoco/jacoco/blob/master/org.jacoco. > core/src/org/jacoco/core/internal/analysis/filter/ > LombokGeneratedFilter.java > > This feature will be available for consumption in the next releases of > Lombok (1.16.8+) and JaCoCo (0.7.9+). > > Given this, Marc suggested that Groovy could follow the same idea and > provide an annotation that JaCoCo can identify, say for example > @groovy.transform.Generated. > > If such annotation were to be added to Groovy we would need (at least) th= e > following steps too: > - update compiler to annotate `getProperty`, `setProperty`, > `getMetaClass`, and `invokeMethod` when the class does not explicitly > defines any of those methods. > - review and update all core AST xforms that generate methods that shoul= d > be skipped from coverage. > - document the usage of this annotation and encourage AST xform > developers to use it once they upgrade. > > Would be great to have this feature in the 2.6.0 release if possible. > > Thoughts? > > ------------------------------------------- > Java Champion; Groovy Enthusiast > http://andresalmiray.com > http://www.linkedin.com/in/aalmiray > -- > What goes up, must come down. Ask any system administrator. > There are 10 types of people in the world: Those who understand binary, > and those who don't. > To understand recursion, we must first understand recursion. > > --f403045fc0745e00650558ad398a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Unfortunately that annotation is coming in JDK9. We&#= 39;ll need something that can be used with JDK7
=C2=A0an upwards.<= br>

---= ----------------------------------------
Java Champion; Groovy Enthusias= t
http://andresal= miray.com
http://www.linkedin.com/in/aalmiray
--
What goes up, must= come down. Ask any system administrator.
There are 10 types of people i= n the world: Those who understand binary, and those who don't.
To un= derstand recursion, we must first understand recursion.

On Fri, Sep 8, 2017 at 3:00 PM, Remi Forax <= span dir=3D"ltr"><forax@univ-mlv.fr> wrote:
=
A standard annotation for generated code was added in Jav= a 9:

R=C3=A9mi

<= /div>
De: "Andres Almiray" <<= a href=3D"mailto:aalmiray@gmail.com" target=3D"_blank">aalmiray@gmail.com>
=C3=80: dev@groovy.apache.org
Envoy=C3=A9: Vendredi 8 Septem= bre 2017 11:41:18
Objet: Groovy and code coverage
Hello everyone,

As you may be awa= re there are only a few choices in the Java pace that can be used for code = coverage, JaCoCo being the one that gives the most accurate results. While = it's easy to setup JaCoco for Groovy sources there are times where the = tool reports no coverage for some lines of code that should not have been c= ounted for coverage in the first case, these are some of the methods coming= from GroovyObject and AST transformations, specifically `getProperty`, `se= tProperty`, `getMetaClass`, and `invokeMethod`.

I had a chat with Ma= rc Hoffmann yesterday about this situation, which is a topic we've disc= ussed a few times in the past. I've got some good news, Groovy is not a= lone in this problem, the Lombok project has suffered the same fate which h= as prompted them to seek a solution. The alternative they came up with is t= o have Lombok identified generated code that should not be covered with a s= pecial annotation (@lombok.Generated), JaCoCo has a filtering feature (not = yet public) that can identify elements annotated with said annotation and s= kip them from coverage reports. See

https://proje= ctlombok.org/api/index.html?lombok/Generated.html
https://gi= thub.com/jacoco/jacoco/pull/513
https://github.com= /jacoco/jacoco/blob/master/org.jacoco.core/src/org/jacoco/core/internal/analysis/filter/LombokGeneratedFilter.java

This= feature will be available for consumption in the next releases of Lombok (= 1.16.8+) and JaCoCo (0.7.9+).

Given this, Marc suggested that Groovy= could follow the same idea and provide an annotation that JaCoCo can ident= ify, say for example @groovy.transform.Generated.

If such annotation= were to be added to Groovy we would need (at least) the following steps to= o:
=C2=A0- update compiler to annotate `getProperty`, `setProperty`, `ge= tMetaClass`, and `invokeMethod` when the class does not explicitly defines = any of those methods.
=C2=A0- review and update all core AST xforms that= generate methods that should be skipped from coverage.
=C2=A0- document= the usage of this annotation and encourage AST xform developers to use it = once they upgrade.

Would be great to have this feature in the 2.6.0 = release if possible.

Thoughts?

----------= ---------------------------------
Java Champion; Groovy Enthusiast<= br>http://andresalmi= ray.com
http://www.linkedin.com/in/aalmiray
--
What goes up, m= ust come down. Ask any system administrator.
There are 10 types of peopl= e in the world: Those who understand binary, and those who don't.
To= understand recursion, we must first understand recursion.

--f403045fc0745e00650558ad398a--