Skip to content
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

Jacoco extensions results in java.lang.NoSuchMethodError: 'boolean[] ***.$jacocoInit()' for kotlin when panache repo is injected #18522

Closed
languitar opened this issue Jul 8, 2021 · 3 comments · Fixed by #18707
Labels
Milestone

Comments

@languitar
Copy link
Contributor

languitar commented Jul 8, 2021

Describe the bug

In this reproduction project mvn verify results in the following test error:

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.751 s <<< FAILURE! - in org.acme.rest.GreetingResourceTest
[ERROR] org.acme.rest.GreetingResourceTest.testHelloEndpoint  Time elapsed: 0.004 s  <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: Failed to create test instance
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoSuchMethodError: 'boolean[] org.acme.rest.FooEntityRepo.$jacocoInit()'

This happens in case:

  • the quarkus jacoco extension is included
  • AND a Panache repository is injected into a test class

Things work if only one of the above conditions is met.

Expected behavior

Tests can be executed and coverage reports are functional.

Actual behavior

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.751 s <<< FAILURE! - in org.acme.rest.GreetingResourceTest
[ERROR] org.acme.rest.GreetingResourceTest.testHelloEndpoint  Time elapsed: 0.004 s  <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: Failed to create test instance
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoSuchMethodError: 'boolean[] org.acme.rest.FooEntityRepo.$jacocoInit()'

To Reproduce

Steps to reproduce the behavior:

  1. Clone the reproduction project
  2. Execute mvn verify

Configuration

As included in the project

Environment (please complete the following information):

Output of uname -a or ver

Linux pres 5.10.47-1-lts #1 SMP Wed, 30 Jun 2021 13:52:19 +0000 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9)
OpenJDK 64-Bit Server VM (build 11.0.11+9, mixed mode)

GraalVM version (if different from Java)

not used here

Quarkus version or git rev

As in the project. 2.0.1.Final

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

Apache Maven 3.8.1 (NON-CANONICAL_2021-04-26T21:52:54Z_root)
Maven home: /opt/maven
Java version: 11.0.11, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.47-1-lts", arch: "amd64", family: "unix"
@languitar languitar added the kind/bug Something isn't working label Jul 8, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 8, 2021

/cc @FroMage, @evanchooly, @loicmathieu

@languitar languitar changed the title Jacoco extensions results in java.lang.NoSuchMethodError: 'boolean[] org.acme.rest.FooEntityRepo.$jacocoInit()' for kotlin when panache repo is injected Jacoco extensions results in java.lang.NoSuchMethodError: 'boolean[] ***.$jacocoInit()' for kotlin when panache repo is injected Jul 8, 2021
@robertambrose21
Copy link

Is there any workaround for this?

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Jul 15, 2021
Panache is deleting the extra methods that jacoco adds

Fixes quarkusio#18522
@languitar
Copy link
Contributor Author

I could get things going by manually configuring jacoco as shown in this quickstart: https://github.com/quarkusio/quarkus-quickstarts/blob/main/tests-with-coverage-quickstart/pom.xml

@quarkus-bot quarkus-bot bot added this to the 2.2 - main milestone Jul 15, 2021
@gsmet gsmet modified the milestones: 2.2 - main, 2.0.3.Final Jul 16, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 16, 2021
Panache is deleting the extra methods that jacoco adds

Fixes quarkusio#18522

(cherry picked from commit 26e3ac7)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 16, 2021
Panache is deleting the extra methods that jacoco adds

Fixes quarkusio#18522

(cherry picked from commit 26e3ac7)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 16, 2021
Panache is deleting the extra methods that jacoco adds

Fixes quarkusio#18522

(cherry picked from commit 26e3ac7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants