8000 Mocking jOOQ 3.15+ fails with "attempted to add a method" · Issue #1118 · mockk/mockk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Mocking jOOQ 3.15+ fails with "attempted to add a method" #1118
Closed
@marcelstoer

Description

@marcelstoer

This issue is the continuation of the analysis started and documented at https://stackoverflow.com/q/76665966/131929. Also, this is very closely related to #255 and #477 which both became stale.

I tried to debug further but the exception stems from native JVM code. Hence, I suspect it requires someone intimately familiar with this project to look into it. Allow me to tag the top contributors @oleksiyp, @aSemy and @Raibaz.

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

Mocking the jOOQ 3.15+ TableImpl class should work.

Current Behavior

It fails with

java.lang.UnsupportedOperationException: class redefinition failed: attempted to add a method

Failure Information (for bugs)

Mocking the same class with jOOQ 3.14 works fine. The 3.15+ versions are different in that they also implement interfaces which seems to trip up MockK. With the earlier jOOQ versions MockK prints this trace log

Taking instance of class org.jooq.impl.TableImpl itself because it is not abstract and no additional interfaces specified.

It fails both on Java 11 and Java 17.

Steps to Reproduce

Check out the reproducer at https://github.com/marcelstoer/jooq-mockk-test and run mvn test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0