New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude methods annotated with @lombok.Generated #513

Merged
merged 1 commit into from Apr 3, 2017

Conversation

@marchof
Member

marchof commented Apr 3, 2017

This is a follow-up for #495 to migrate @t1 's work to the new filtering APIs.

@marchof marchof self-assigned this Apr 3, 2017

marchof added a commit that referenced this pull request Apr 3, 2017

GitHub #513: Exclude methods annotated with @lombok.Generated
Based in initial contribution by Rüdiger zu Dohna.

@Godin Godin added this to IN PROGRESS in Filtering Apr 3, 2017

@Godin Godin added this to the 0.7.10 milestone Apr 3, 2017

marchof added a commit that referenced this pull request Apr 3, 2017

GitHub #513: Exclude methods annotated with @lombok.Generated
Based on initial contribution by Rüdiger zu Dohna.
@marchof

This comment has been minimized.

Show comment
Hide comment
@marchof

marchof Apr 3, 2017

Member

@Godin thx for the review! Hopefully fixed all issues.

Member

marchof commented Apr 3, 2017

@Godin thx for the review! Hopefully fixed all issues.

Add filter for methods annotated with @lombok.Generated
Based on initial contribution by Rüdiger zu Dohna.
@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Apr 3, 2017

Member

End-to-end test - example.zip

Without this change using JaCoCo 0.7.9 :

before-methods

before-source

After this change :

after-methods

after-source

Member

Godin commented Apr 3, 2017

End-to-end test - example.zip

Without this change using JaCoCo 0.7.9 :

before-methods

before-source

After this change :

after-methods

after-source

@Godin

Godin approved these changes Apr 3, 2017

@Godin Godin merged commit 7f719c8 into master Apr 3, 2017

4 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@Godin Godin deleted the issue-513 branch Apr 3, 2017

@Godin Godin moved this from IN PROGRESS to DONE in Filtering Apr 3, 2017

@MichaelZett

This comment has been minimized.

Show comment
Hide comment
@MichaelZett

MichaelZett Apr 6, 2017

Hi, nice one. I'd like to try this out. I let lombok generate "lombok.Generated" and use the jacoco-agent with gradle. I tried the snapshot from 20170404 (-17) and it does not seem to be in there. Or do I have to configure jacoco somehow?

MichaelZett commented Apr 6, 2017

Hi, nice one. I'd like to try this out. I let lombok generate "lombok.Generated" and use the jacoco-agent with gradle. I tried the snapshot from 20170404 (-17) and it does not seem to be in there. Or do I have to configure jacoco somehow?

@marchof

This comment has been minimized.

Show comment
Hide comment
@marchof

marchof Apr 6, 2017

Member

@MichaelZett I just double checked the latest snaphot (from 20170404 on) has this feature. Are you sure you're using the latest version of Lombok? The @Generated annotation has been introduced recently in version 1.16.14.

Member

marchof commented Apr 6, 2017

@MichaelZett I just double checked the latest snaphot (from 20170404 on) has this feature. Are you sure you're using the latest version of Lombok? The @Generated annotation has been introduced recently in version 1.16.14.

@t1

This comment has been minimized.

Show comment
Hide comment
@t1

t1 Apr 7, 2017

Works fine. Big thanks!

When I first looked at the code, I thought it might not work when there are other annotations next to @lombok.Generated. Something like:

    @lombok.Getter(onMethod_ = { @javax.xml.bind.annotation.XmlAttribute(name = "bar") })
    private String foo;

But it does work ;-)

Is it foreseeable when this may get released?

t1 commented Apr 7, 2017

Works fine. Big thanks!

When I first looked at the code, I thought it might not work when there are other annotations next to @lombok.Generated. Something like:

    @lombok.Getter(onMethod_ = { @javax.xml.bind.annotation.XmlAttribute(name = "bar") })
    private String foo;

But it does work ;-)

Is it foreseeable when this may get released?

@MichaelZett

This comment has been minimized.

Show comment
Hide comment
@MichaelZett

MichaelZett Apr 7, 2017

@marchof yes, Lombok annotation is generated. I checked with delombok. Do I have to configure the filters to use? Does anyone has checked it with gradle (3.4.1)? Gradle uses the jacoco agent lib.

MichaelZett commented Apr 7, 2017

@marchof yes, Lombok annotation is generated. I checked with delombok. Do I have to configure the filters to use? Does anyone has checked it with gradle (3.4.1)? Gradle uses the jacoco agent lib.

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Apr 7, 2017

Member

@MichaelZett here is an example with Gradle that works just perfectly - example.zip

Member

Godin commented Apr 7, 2017

@MichaelZett here is an example with Gradle that works just perfectly - example.zip

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Apr 7, 2017

Member

@t1

Is it foreseeable when this may get released?

please be patient and give us some time to first finish some other filters. Thank you for your understanding.

Member

Godin commented Apr 7, 2017

@t1

Is it foreseeable when this may get released?

please be patient and give us some time to first finish some other filters. Thank you for your understanding.

@t1

This comment has been minimized.

Show comment
Hide comment
@t1

t1 Apr 8, 2017

@Godin

please be patient and give us some time to first finish some other filters.

Am I wrong to assume that this may take quite a while, as most of those filters are much harder to build than @lombok.Generated? How much work is it to build a release? I understand that also users might be annoyed by too many releases... at least I am annoyed by too many releases of Mockito ;-)... so this has to be taken into account, but I also have the need to get coverage reports that are expressive. We heavily rely on Lombok and often see coverage as low as 30% in DTO packages. We hardly look at the coverage there. If we had this fix, we would get up to maybe 90%, which already would help us greatly in seeing and then focussing on the important parts. The last 10% also would be cool, but they won't stop us from looking at the coverage.

I don't like the alternative to internally release a fork.

t1 commented Apr 8, 2017

@Godin

please be patient and give us some time to first finish some other filters.

Am I wrong to assume that this may take quite a while, as most of those filters are much harder to build than @lombok.Generated? How much work is it to build a release? I understand that also users might be annoyed by too many releases... at least I am annoyed by too many releases of Mockito ;-)... so this has to be taken into account, but I also have the need to get coverage reports that are expressive. We heavily rely on Lombok and often see coverage as low as 30% in DTO packages. We hardly look at the coverage there. If we had this fix, we would get up to maybe 90%, which already would help us greatly in seeing and then focussing on the important parts. The last 10% also would be cool, but they won't stop us from looking at the coverage.

I don't like the alternative to internally release a fork.

@BeneStem

This comment has been minimized.

Show comment
Hide comment
@BeneStem

BeneStem Apr 9, 2017

@Godin @t1 We would love to have this feature released as soon as possible as well.

Thank you all for the great work. We will be patient and wait :)

For now we will be using the SNAPSHOT version. It is working great!

BeneStem commented Apr 9, 2017

@Godin @t1 We would love to have this feature released as soon as possible as well.

Thank you all for the great work. We will be patient and wait :)

For now we will be using the SNAPSHOT version. It is working great!

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Apr 10, 2017

Member

@t1

Am I wrong to assume that this may take quite a while, as most of those filters are much harder to build than @lombok.Generated?

Filters for synchronized statement and methods in enums are already in master - see eaef191 and e94c7af respectively. We're finalizing filters for try-with-resources statement and String in switch statement in PRs #500 and #496 respectively. From here IMO we'd better finish current work than do two releases within short timeframe. So please be a bit patient.

Member

Godin commented Apr 10, 2017

@t1

Am I wrong to assume that this may take quite a while, as most of those filters are much harder to build than @lombok.Generated?

Filters for synchronized statement and methods in enums are already in master - see eaef191 and e94c7af respectively. We're finalizing filters for try-with-resources statement and String in switch statement in PRs #500 and #496 respectively. From here IMO we'd better finish current work than do two releases within short timeframe. So please be a bit patient.

@MichaelZett

This comment has been minimized.

Show comment
Hide comment
@MichaelZett

MichaelZett Apr 11, 2017

@Godin Thanks for the zip. When I take this and run gradlew clean build, it produces the attached test.exec. When I look at this in intellij or sonarqube it shows still 4 missed lines. What could be the problem?
test.exec.tar.gz

MichaelZett commented Apr 11, 2017

@Godin Thanks for the zip. When I take this and run gradlew clean build, it produces the attached test.exec. When I look at this in intellij or sonarqube it shows still 4 missed lines. What could be the problem?
test.exec.tar.gz

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Apr 11, 2017

Member

@MichaelZett filtering is performed at a time of report generation (creation of html, xml, etc), not at a time of collection of execution information (creation of exec file). So that tools that read execution data directly instead of reading of xml (which is a kind of mistake on their side to rely on purely internal intermediate format, but what's done is done) and create their own report (such as SonarQube, Jenkins, etc) will need to update their dependency on JaCoCo once it will be released in order to get filtering for reports. We will notify explicitly downstream projects (in particular all mentioned above) about this when our release will be done. So once again - please be patient. Thank you for your understanding.

Member

Godin commented Apr 11, 2017

@MichaelZett filtering is performed at a time of report generation (creation of html, xml, etc), not at a time of collection of execution information (creation of exec file). So that tools that read execution data directly instead of reading of xml (which is a kind of mistake on their side to rely on purely internal intermediate format, but what's done is done) and create their own report (such as SonarQube, Jenkins, etc) will need to update their dependency on JaCoCo once it will be released in order to get filtering for reports. We will notify explicitly downstream projects (in particular all mentioned above) about this when our release will be done. So once again - please be patient. Thank you for your understanding.

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Apr 11, 2017

Member

@MichaelZett also should be mentioned that reports produced by JaCoCo Gradle Plugin (in build/reports/jacoco/test/html/ after gradle clean test jacocoTestReport) and JaCoCo Maven Plugin (in target/site/jacoco/ after mvn clean verify) in the given examples do have filtering because they already use snapshot version of JaCoCo.

Member

Godin commented Apr 11, 2017

@MichaelZett also should be mentioned that reports produced by JaCoCo Gradle Plugin (in build/reports/jacoco/test/html/ after gradle clean test jacocoTestReport) and JaCoCo Maven Plugin (in target/site/jacoco/ after mvn clean verify) in the given examples do have filtering because they already use snapshot version of JaCoCo.

@MichaelZett

This comment has been minimized.

Show comment
Hide comment
@MichaelZett

MichaelZett Apr 11, 2017

@Godin I see, thanks. Will be waiting.

MichaelZett commented Apr 11, 2017

@Godin I see, thanks. Will be waiting.

@t1

This comment has been minimized.

Show comment
Hide comment
@t1

t1 Apr 11, 2017

@Godin : I'll be patient... but I feel a little like a child before christmas ;-)

t1 commented Apr 11, 2017

@Godin : I'll be patient... but I feel a little like a child before christmas ;-)

@tenleo

This comment has been minimized.

Show comment
Hide comment
@tenleo

tenleo Apr 14, 2017

I have successfully used the snapshot build to exclude Lombok generated code. The generated report works nicely now, thanks for this update.

Just curious though: on individual maven projects it works fine, but I have trouble generating an aggregated report for a multi-module Maven project. The reports in each module look fine, but the aggregated report is empty. Has anyone else had this issue?

Maybe its a configuration fault on my side, this is what I added to my root pom:

<plugin>

	<groupId>org.jacoco</groupId>

	<artifactId>jacoco-maven-plugin</artifactId>
	<version>0.7.10-SNAPSHOT</version>
	<configuration>
		<destFile>${project.basedir}/../target/jacoco.exec</destFile>
		<append>true</append>
	</configuration>
	<executions>
		<execution>
			<id>default-prepare-agent</id>
			<goals>
				<goal>prepare-agent</goal>
			</goals>
		</execution>
		<execution>
			<id>report-aggregate</id>
			<phase>prepare-package</phase>
			<goals>
				<goal>report-aggregate</goal>
			</goals>
		</execution>
		<execution>
			<id>default-check</id>
			<goals>
				<goal>check</goal>
			</goals>
			<configuration>
				<rules/>
			</configuration>
		</execution>
	</executions>
</plugin>

tenleo commented Apr 14, 2017

I have successfully used the snapshot build to exclude Lombok generated code. The generated report works nicely now, thanks for this update.

Just curious though: on individual maven projects it works fine, but I have trouble generating an aggregated report for a multi-module Maven project. The reports in each module look fine, but the aggregated report is empty. Has anyone else had this issue?

Maybe its a configuration fault on my side, this is what I added to my root pom:

<plugin>

	<groupId>org.jacoco</groupId>

	<artifactId>jacoco-maven-plugin</artifactId>
	<version>0.7.10-SNAPSHOT</version>
	<configuration>
		<destFile>${project.basedir}/../target/jacoco.exec</destFile>
		<append>true</append>
	</configuration>
	<executions>
		<execution>
			<id>default-prepare-agent</id>
			<goals>
				<goal>prepare-agent</goal>
			</goals>
		</execution>
		<execution>
			<id>report-aggregate</id>
			<phase>prepare-package</phase>
			<goals>
				<goal>report-aggregate</goal>
			</goals>
		</execution>
		<execution>
			<id>default-check</id>
			<goals>
				<goal>check</goal>
			</goals>
			<configuration>
				<rules/>
			</configuration>
		</execution>
	</executions>
</plugin>
@marchof

This comment has been minimized.

Show comment
Hide comment
@marchof

marchof Apr 14, 2017

Member

@tenleo Thanks for your feedback! Aggregate reports work differently. Please see documentation. You need to specify a separate module which defined the content of the report. As this is a completely different issue please use our mailing list for further questions.

Member

marchof commented Apr 14, 2017

@tenleo Thanks for your feedback! Aggregate reports work differently. Please see documentation. You need to specify a separate module which defined the content of the report. As this is a completely different issue please use our mailing list for further questions.

@Sir4ur0n

This comment has been minimized.

Show comment
Hide comment
@Sir4ur0n

Sir4ur0n Apr 21, 2017

Hi guys,

I'm curious, did anyone make it work with SonarQube?
I seem to have a clean JaCoCo report with the latest snapshot (0.7.10-SNAPSHOT) when I look at ./target/site/jacoco/index.html report.
However the report in SonarQube is completely different: different code coverage (a lot less), different values for metrics like Complexity, Lines of code, etc...

Is it just me?
I even tried with the tiny example project provided by @Godin on the 2017-04-03 (I wrote one test method covering one stupid method doing a System.out.println for the sake of having one test) and then published in my SonarQube, and the results are massively different.

I created a small github project to ease reproduction of the issue: https://github.com/Sir4ur0n/example-jacoco-lombok-sonarqube

Here's the JaCoCo report:
image
image
Here's the SonarQube report:
image

Any help or pointer on what's wrong would be greatly appreciated :(

Sir4ur0n commented Apr 21, 2017

Hi guys,

I'm curious, did anyone make it work with SonarQube?
I seem to have a clean JaCoCo report with the latest snapshot (0.7.10-SNAPSHOT) when I look at ./target/site/jacoco/index.html report.
However the report in SonarQube is completely different: different code coverage (a lot less), different values for metrics like Complexity, Lines of code, etc...

Is it just me?
I even tried with the tiny example project provided by @Godin on the 2017-04-03 (I wrote one test method covering one stupid method doing a System.out.println for the sake of having one test) and then published in my SonarQube, and the results are massively different.

I created a small github project to ease reproduction of the issue: https://github.com/Sir4ur0n/example-jacoco-lombok-sonarqube

Here's the JaCoCo report:
image
image
Here's the SonarQube report:
image

Any help or pointer on what's wrong would be greatly appreciated :(

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Apr 21, 2017

Member

@Sir4ur0n please read carefully comments in this thread prior to yours, in particular - #513 (comment)

Member

Godin commented Apr 21, 2017

@Sir4ur0n please read carefully comments in this thread prior to yours, in particular - #513 (comment)

@Sir4ur0n

This comment has been minimized.

Show comment
Hide comment
@Sir4ur0n

Sir4ur0n Apr 21, 2017

@Godin Thanks, I had completely missed this comment :'(

Sir4ur0n commented Apr 21, 2017

@Godin Thanks, I had completely missed this comment :'(

@novaterata

This comment has been minimized.

Show comment
Hide comment
@novaterata

novaterata Jun 30, 2017

Do we have an ETA on when 0.7.10 will be released? I couldn't find a release schedule anywhere. Asking specifically for this fix.

novaterata commented Jun 30, 2017

Do we have an ETA on when 0.7.10 will be released? I couldn't find a release schedule anywhere. Asking specifically for this fix.

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Jun 30, 2017

Member

@novaterata please read already existing answers on such question:
https://groups.google.com/forum/#!msg/jacoco/gd8xD30TDNo/SHj-hEq1AAAJ
https://groups.google.com/forum/#!msg/jacoco/-MmsVzC6szM/Q9sPTbAeBAAJ
and in few words - no exact ETA, but as soon as it will be fully ready.
So please be patient and thank you for your understanding.

Member

Godin commented Jun 30, 2017

@novaterata please read already existing answers on such question:
https://groups.google.com/forum/#!msg/jacoco/gd8xD30TDNo/SHj-hEq1AAAJ
https://groups.google.com/forum/#!msg/jacoco/-MmsVzC6szM/Q9sPTbAeBAAJ
and in few words - no exact ETA, but as soon as it will be fully ready.
So please be patient and thank you for your understanding.

@novaterata

This comment has been minimized.

Show comment
Hide comment
@novaterata

novaterata Jun 30, 2017

@Godin Thank you, I didn't know where to even look

novaterata commented Jun 30, 2017

@Godin Thank you, I didn't know where to even look

@Elena6789

This comment has been minimized.

Show comment
Hide comment
@Elena6789

Elena6789 Jul 3, 2017

Is the filter out of lombok supported already in a released version of JaCoCo?Thanks

Elena6789 commented Jul 3, 2017

Is the filter out of lombok supported already in a released version of JaCoCo?Thanks

@novaterata

This comment has been minimized.

Show comment
Hide comment
@novaterata

novaterata Jul 3, 2017

novaterata commented Jul 3, 2017

@Glamdring

This comment has been minimized.

Show comment
Hide comment
@Glamdring

Glamdring Jul 18, 2017

I tried using the latest snapshot, but the report generated in target/site includes the equals(..) method. Has anything changed? Are there specific configurations that one has to enable?

Glamdring commented Jul 18, 2017

I tried using the latest snapshot, but the report generated in target/site includes the equals(..) method. Has anything changed? Are there specific configurations that one has to enable?

@Godin

This comment has been minimized.

Show comment
Hide comment
@Godin

Godin Jul 18, 2017

Member

@Glamdring please read this thread carefully from the beginning - in particular there is full end-to-end example with all the required configuration on Lombok side in #513 (comment)

Member

Godin commented Jul 18, 2017

@Glamdring please read this thread carefully from the beginning - in particular there is full end-to-end example with all the required configuration on Lombok side in #513 (comment)

@Glamdring

This comment has been minimized.

Show comment
Hide comment
@Glamdring

Glamdring Jul 19, 2017

@Godin apologies for overlooking that, thanks.

Glamdring commented Jul 19, 2017

@Godin apologies for overlooking that, thanks.

@miualinionut

This comment has been minimized.

Show comment
Hide comment
@miualinionut

miualinionut Aug 1, 2017

Guys, I am waiting for about 4 months for this feature. Can you please give a DL when will this feature be released ?

miualinionut commented Aug 1, 2017

Guys, I am waiting for about 4 months for this feature. Can you please give a DL when will this feature be released ?

@t1

This comment has been minimized.

Show comment
Hide comment
@t1

t1 Aug 1, 2017

@miualinionut: I guess it's done when it's done. That's the way open source projects work when they are driven by people spending their spare time.

@Godin: I'd rather request an intermediate release of the things that already work instead of waiting until everything is complete. Would that be possible?

t1 commented Aug 1, 2017

@miualinionut: I guess it's done when it's done. That's the way open source projects work when they are driven by people spending their spare time.

@Godin: I'd rather request an intermediate release of the things that already work instead of waiting until everything is complete. Would that be possible?

@novaterata

This comment has been minimized.

Show comment
Hide comment
@novaterata

novaterata Aug 1, 2017

@t1 you can use the snapshot build. There is a repository you can add https://oss.sonatype.org/content/repositories/snapshots then the snapshot version should be available via maven dependencies

novaterata commented Aug 1, 2017

@t1 you can use the snapshot build. There is a repository you can add https://oss.sonatype.org/content/repositories/snapshots then the snapshot version should be available via maven dependencies

@MAGGGG

This comment has been minimized.

Show comment
Hide comment
@MAGGGG

MAGGGG Aug 2, 2017

Hello everyone ...
Same question like earlier. When 0.7.10 will be released ?
Waiting for this features:

  • Exclude from a report methods which are annotated with @lombok.Generated. Initial analysis and contribution by Rüdiger zu Dohna. (GitHub #513).

MAGGGG commented Aug 2, 2017

Hello everyone ...
Same question like earlier. When 0.7.10 will be released ?
Waiting for this features:

  • Exclude from a report methods which are annotated with @lombok.Generated. Initial analysis and contribution by Rüdiger zu Dohna. (GitHub #513).
@uzonyib

This comment has been minimized.

Show comment
Hide comment
@uzonyib

uzonyib Nov 8, 2017

Hi, is there an ETA for the release of this feature?

uzonyib commented Nov 8, 2017

Hi, is there an ETA for the release of this feature?

@marchof

This comment has been minimized.

Show comment
Hide comment
@marchof
Member

marchof commented Nov 8, 2017

@jacoco jacoco locked and limited conversation to collaborators Nov 8, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.