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 50ED0200CFE for ; Fri, 8 Sep 2017 15:06:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4F9E51609C5; Fri, 8 Sep 2017 13:06:10 +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 6DAC51609BF for ; Fri, 8 Sep 2017 15:06:09 +0200 (CEST) Received: (qmail 11431 invoked by uid 500); 8 Sep 2017 13:06:07 -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 11421 invoked by uid 99); 8 Sep 2017 13:06:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Sep 2017 13:06:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 17EE318FC0C for ; Fri, 8 Sep 2017 13:06:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.301 X-Spam-Level: * X-Spam-Status: No, score=1.301 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id kmIxmhvm2xpY for ; Fri, 8 Sep 2017 13:06:03 +0000 (UTC) Received: from smtpout20.partage.renater.fr (smtpout02-ext4.partage.renater.fr [194.254.241.31]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id CC9F15FCB9 for ; Fri, 8 Sep 2017 13:06:02 +0000 (UTC) Received: from zmtaout02.partage.renater.fr (zmtaout02.partage.renater.fr [194.254.241.30]) by smtpout20.partage.renater.fr (Postfix) with ESMTP id 0499EBFAEA for ; Fri, 8 Sep 2017 15:06:02 +0200 (CEST) Received: from zmtaout02.partage.renater.fr (localhost [127.0.0.1]) by zmtaout02.partage.renater.fr (Postfix) with ESMTPS id 00CE1200D6 for ; Fri, 8 Sep 2017 15:06:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zmtaout02.partage.renater.fr (Postfix) with ESMTP id E5B94200E5 for ; Fri, 8 Sep 2017 15:06:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at zmtaout02.partage.renater.fr Received: from zmtaout02.partage.renater.fr ([127.0.0.1]) by localhost (zmtaout02.partage.renater.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id dAJMSRu_u3jB for ; Fri, 8 Sep 2017 15:06:01 +0200 (CEST) Received: from zstore27-staff.partage.renater.fr (zstore27-staff.partage.renater.fr [10.254.241.53]) by zmtaout02.partage.renater.fr (Postfix) with ESMTP id CC1E0200D6 for ; Fri, 8 Sep 2017 15:06:01 +0200 (CEST) Date: Fri, 8 Sep 2017 15:06:01 +0200 (CEST) From: Remi Forax To: dev Message-ID: <1069952775.2566818.1504875961758.JavaMail.zimbra@u-pem.fr> In-Reply-To: References: <1116949062.2563601.1504875627771.JavaMail.zimbra@u-pem.fr> Subject: Re: Groovy and code coverage MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_f11dbe62-0e03-4281-af90-4ae828ef5190" X-Originating-IP: [194.254.242.1] X-Mailer: Zimbra 8.7.10_GA_1829 (ZimbraWebClient - FF53 (Linux)/8.7.10_GA_1829) Thread-Topic: Groovy and code coverage Thread-Index: ShbuXl8K9ZTZHiFcWaJZbeVwjDalOQ== archived-at: Fri, 08 Sep 2017 13:06:10 -0000 --=_f11dbe62-0e03-4281-af90-4ae828ef5190 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable You are generating bytecode ?=20 R=C3=A9mi=20 > De: "Andres Almiray" > =C3=80: "dev" > Envoy=C3=A9: Vendredi 8 Septembre 2017 15:04:57 > Objet: Re: Groovy and code coverage > Unfortunately that annotation is coming in JDK9. We'll need something tha= t can > be used with JDK7 > an upwards. > ------------------------------------------- > Java Champion; Groovy Enthusiast > [ http://andresalmiray.com/ | http://andresalmiray.com ] > [ http://www.linkedin.com/in/aalmiray | http://www.linkedin.com/in/aalmir= ay ] > -- > What goes up, must come down. Ask any system administrator. > There are 10 types of people in the world: Those who understand binary, a= nd > those who don't. > To understand recursion, we must first understand recursion. > On Fri, Sep 8, 2017 at 3:00 PM, Remi Forax < [ mailto:forax@univ-mlv.fr | > forax@univ-mlv.fr ] > 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 >> | >> http://download.java.net/java/jdk9/docs/api/javax/annotation/processing/= Generated.html >> ] >> R=C3=A9mi >>> De: "Andres Almiray" < [ mailto:aalmiray@gmail.com | aalmiray@gmail.com= ] > >>> =C3=80: [ mailto:dev@groovy.apache.org | 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 = can be >>> used for code coverage, JaCoCo being the one that gives the most accura= te >>> results. While it's easy to setup JaCoco for Groovy sources there are t= imes >>> where the tool reports no coverage for some lines of code that should n= ot have >>> been counted for coverage in the first case, these are some of the meth= ods >>> coming from GroovyObject and AST transformations, specifically `getProp= erty`, >>> `setProperty`, `getMetaClass`, and `invokeMethod`. >>> I had a chat with Marc Hoffmann yesterday about this situation, which i= s a topic >>> we've discussed a few times in the past. I've got some good news, Groov= y is not >>> alone in this problem, the Lombok project has suffered the same fate wh= ich has >>> prompted them to seek a solution. The alternative they came up with is = to have >>> Lombok identified generated code that should not be covered with a spec= ial >>> 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://projectlombok.org/api/index.html?lombok/Generated.html ] >>> [ https://github.com/jacoco/jacoco/pull/513 | >>> https://github.com/jacoco/jacoco/pull/513 ] >>> [ >>> https://github.com/jacoco/jacoco/blob/master/org.jacoco.core/src/org/ja= coco/core/internal/analysis/filter/LombokGeneratedFilter.java >>> | >>> https://github.com/jacoco/jacoco/blob/master/org.jacoco.core/src/org/ja= coco/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 p= rovide 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) = the >>> following steps too: >>> - update compiler to annotate `getProperty`, `setProperty`, `getMetaCla= ss`, and >>> `invokeMethod` when the class does not explicitly defines any of those = methods. >>> - review and update all core AST xforms that generate methods that shou= ld be >>> skipped from coverage. >>> - document the usage of this annotation and encourage AST xform develop= ers 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://andresalmiray.com ] >>> [ http://www.linkedin.com/in/aalmiray | http://www.linkedin.com/in/aalm= iray ] >>> -- >>> 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. --=_f11dbe62-0e03-4281-af90-4ae828ef5190 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
You are generating bytecode ?

R=C3=A9mi


<= blockquote style=3D"border-left:2px solid #1010FF;margin-left:5px;padding-l= eft:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:non= e;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">De: "Andre= s Almiray" <aalmiray@gmail.com>
=C3=80: "dev" <dev@groov= y.apache.org>
Envoy=C3=A9: Vendredi 8 Septembre 2017 15:04:57<= br>Objet: Re: Groovy and code coverage
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.linke= din.com/in/aalmiray
--
What goes up, must come down. Ask any syst= em administrator.
There are 10 types of people in the world: Those who u= nderstand 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 <= span dir=3D"ltr"><forax@univ-mlv.fr> wrote:
=
A standard annotation for generated code was added in Jav= a 9:

R=C3=A9mi


De= : "Andres Almiray" <aalmiray@gmail.com>
=C3=80: dev@groovy.apache.org
Envoy= =C3=A9: Vendredi 8 Septembre 2017 11:41:18
Objet: Groovy and = code coverage
Hello every= one,

As you may be aware there are only a few choices in the Java pa= ce 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 t= here are times where the tool reports no coverage for some lines of code th= at should not have been counted for coverage in the first case, these are s= ome of the methods coming from GroovyObject and AST transformations, specif= ically `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 they = came up with is to have Lombok identified generated code that should not be= covered with a special annotation (@lombok.Generated), JaCoCo has a filter= ing 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
<= a href=3D"https://github.com/jacoco/jacoco/pull/513" target=3D"_blank">http= s://github.com/jacoco/jacoco/pull/513
https://github.co= m/jacoco/jacoco/blob/master/org.jacoco.core/src/org/jacoco/core/internal/an= alysis/filter/LombokGeneratedFilter.java

This feature will be av= ailable 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 s= ame idea and provide an annotation that JaCoCo can identify, say for exampl= e @groovy.transform.Generated.

If such annotation were to be added t= o Groovy we would need (at least) the following steps too:
 - updat= e compiler to annotate `getProperty`, `setProperty`, `getMetaClass`, and `i= nvokeMethod` when the class does not explicitly defines any of those method= s.
 - review and update all core AST xforms that generate methods t= hat should be skipped from coverage.
 - document the usage of this = annotation and encourage AST xform developers to use it once they upgrade.<= br>
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 unde= rstand binary, and those who don't.
To understand recursion, we must fir= st understand recursion.


--=_f11dbe62-0e03-4281-af90-4ae828ef5190--