quarkus: Jacoco doesn't cover a class that is an injection by constructor

Describe the bug

Hi guys

Today we have a coverage problem with jacoco. An ApplicationScope bean that use an injection by constructor isn’t cover by jacoco.

Expected behavior

Jacoco should cover all classes, whatever the way of dependency injection.

Actual behavior

No response

How to Reproduce?

You have an example project by file zip file just at the end of this message.

Output of uname -a or ver

MSYS_NT-10.0-19045 3.3.6-bec3d608-341.x86_64 2023-02-22 08:29 UTC x86_64 Msys

Output of java -version

Java version: 17.0.6, vendor: BellSoft, runtime: scoop\apps\liberica17-full-jdk\current

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.16.5.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)

Additional information

jacoco.zip

Thanks !

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (14 by maintainers)

Commits related to this issue

Most upvoted comments

IIRC, Jacoco skips over code if it has the synthetic modifier, but I was also under the impression that Arc does add that modifier when it adds a no-args constructor

Interesting, didn’t know that.

Maybe the fact that it’s public is causing the problem? Can the constructor be made package private @mkouba @manovotn ?

Yes, that should work. CDI needs any non-private.