Skip to content

Conversation

@datoma
Copy link
Contributor

@datoma datoma commented Oct 10, 2017

Hackergarten Bern Session, co-hacked with @aalmiray and @marchof

highres_465229986

@aalmiray
Copy link
Contributor

Here's the Groovy side of the equation apache/groovy#617

@marchof
Copy link
Member

marchof commented Oct 11, 2017

@aalmiray Thanks! Two questions:

  • Is there a build or SNAPSHOT available of this Branch so we can test integration? JaCoCo build of this branch is here.
  • What is the Groovy version which will include this feature? So we can make a reference to the required version in our change log.

@Godin
Copy link
Member

Godin commented Oct 11, 2017

@datoma @aalmiray cool! thank you for contribution! 👍

@aalmiray impatient to try full end-to-end example, so same questions as from @marchof plus maybe you can advise some Groovy-based project where JaCoCo is already used, so that we'll be able to use it as such end-to-end example? And in any case it can be a nice addition for page https://github.com/jacoco/jacoco/wiki/Projects-that-use-JaCoCo 😉

Also wondering if you know examples of generated code that might require filtering and is not represented by generated methods, but is inside of non-generated methods?

@aalmiray
Copy link
Contributor

@marchof this feature currently targets Groovy 2.6.0

@Godin I use JaCoCo on the Griffon project. Trust me when I say I'll be the first to try out this new feature 😄

@marchof marchof requested a review from Godin October 12, 2017 20:01
@marchof marchof self-assigned this Oct 12, 2017
@marchof
Copy link
Member

marchof commented Oct 16, 2017

@Godin Groovy side has been merged on master, 2_5_x and 2_6_x. Can you review our side?

}

private boolean hasAnnotation(final MethodNode methodNode) {
final List<AnnotationNode> runtimeInvisibleAnnotations = methodNode.invisibleAnnotations;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In contrast to Lombok, Groovy adds visible annotation, while here we check only invisibleAnnotations, so that currently filter doesn't work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Godin Excellent catch! Fixed ✅

Copy link
Member

@Godin Godin Oct 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marchof nothing extraordinary - I'm simply doing end-to-end testing 😉

Initial analysis and contribution by Rüdiger zu Dohna.
(GitHub <a href="https://github.com/jacoco/jacoco/issues/513">#513</a>).</li>
<li>Exclude from a report methods which are annotated with <code>@groovy.transform.Generated</code>
to better integrate with Groovy >= 2.6.0. Thanks to Andres Almiray to make this possible!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a native English speaker, but "to make this possible" looks/sounds weird for me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I believe that >= 2.6.0 should be replaced by >= 2.5.0 since change on Groovy side was merged not just into master and 2_6_x branches, but also into 2_5_x.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess "Thanks to Andres Almiray for making this possible!" would work, but perhaps just rephrase to match the preceding bullet or say "for the contribution" or something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjkail Thanks for your input! What I want to express here that Andres triggered the introduction of the annotation in the Groovy compiler.

Copy link
Contributor

@bjkail bjkail Oct 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, then "for making this possible" would work, but "this" seems ambiguous, so I would say "for adding the annotation to Groovy, which made this possible" (or "starting the discussion to add the annotation to Groovy", or whatever was done :-)).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Godin @bjkail Fixed wording and version range ✅

import org.objectweb.asm.tree.MethodNode;

/**
* Filters which filters annotated methods.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Filters which filters" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I'm wondering why abstracting instead of having simply one class that will handle both annotations?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Godin I would prefer to have a separate class for every filter:

  • Separate testing of different concerns
  • Possibly enable/disable filters separately
  • I could imagine that we add meta methods/annotations to filters for generating documentation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Godin Reworked JavaDoc ✅

@Godin
Copy link
Member

Godin commented Oct 17, 2017

End-to-end test - example.zip
Note that class is abstract, otherwise generated and annotated methods will be marked as synthetic and thus filtered even without this change.

Without this change using JaCoCo 0.7.9:
before

After this change:
after

@Godin Godin added this to the 0.8.0 milestone Oct 17, 2017
@Godin Godin force-pushed the groovyGeneratedFilter branch from a307ddc to 3921698 Compare October 17, 2017 20:43
@Godin Godin merged commit ec6287a into jacoco:master Oct 17, 2017
@aalmiray
Copy link
Contributor

Have to check again with @blackdrag why the GroovyObjectMethods are marked as synthetic if the class is not abstract (which it shouldn't be).

@Godin
Copy link
Member

Godin commented Oct 17, 2017

@aalmiray well, in any case they are filtered 😉 I was more wondering why generated setters and getters do not have nor line numbers (was expecting line of a field), nor annotation? But that's not so important for end-to-end test here and now that's entirely up to you, Groovy-guys, to mark whatewer you want 😉 Thanks again! 👍 Great collaboration! ❤️

@jacoco jacoco locked as resolved and limited conversation to collaborators Jan 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants