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

Fix callOriginal on default interface method #1203

Merged

Conversation

flapenna
Copy link
Contributor

Issue: #64

The Kotlin compiler generates an additional class that contains an implementation of a default method as a static member. This method will always be intercepted by InterceptNoSuper since it doesn't have a @SuperCall.

Reference:

@RuntimeType
public static Object interceptNoSuper(@ProxyAdviceId long id,
@This Object self,
@Origin Method method,
@AllArguments Object[] args) throws Throwable {

To determine whether the method is a default interface method or not, I have implemented a new utility class named DefaultInterfaceMethodResolver.
This class attempts to find the DefaultImpls class and then the default method.

@flapenna flapenna changed the title fix: callOriginal on default interface method Fix callOriginal on default interface method Jan 12, 2024
@flapenna flapenna force-pushed the fix-calloriginal-default-interface-method branch from 07694f1 to 3ee06d9 Compare January 12, 2024 17:03
@flapenna flapenna force-pushed the fix-calloriginal-default-interface-method branch from 3ee06d9 to 5512f97 Compare January 12, 2024 17:11
@Raibaz
Copy link
Collaborator

Raibaz commented Jan 13, 2024

Wow, thanks for fixing an issue that has been there almost forever!

@Raibaz Raibaz merged commit ed50694 into mockk:master Jan 13, 2024
11 checks passed
sksamuel pushed a commit to kotest/kotest that referenced this pull request Mar 9, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [io.mockk:mockk](https://mockk.io)
([source](https://togithub.com/mockk/mockk)) | `1.13.9` -> `1.13.10` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/io.mockk:mockk/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.mockk:mockk/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.mockk:mockk/1.13.9/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.mockk:mockk/1.13.9/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>mockk/mockk (io.mockk:mockk)</summary>

### [`v1.13.10`](https://togithub.com/mockk/mockk/releases/tag/1.13.10)

[Compare
Source](https://togithub.com/mockk/mockk/compare/1.13.9...1.13.10)

#### What's Changed

- Add support to nested value classes by
[@&#8203;rotilho](https://togithub.com/rotilho) in
[mockk/mockk#1202
- Fix callOriginal on default interface method by
[@&#8203;flapenna](https://togithub.com/flapenna) in
[mockk/mockk#1203
- Only unbox value class answers when appropriate by
[@&#8203;jselbo](https://togithub.com/jselbo) in
[mockk/mockk#1204
- Fix capture using mutable list of value class by
[@&#8203;ath0s](https://togithub.com/ath0s) in
[mockk/mockk#1209
- Updates documentation to include example access error workaround for
Android users by [@&#8203;JakeSteam](https://togithub.com/JakeSteam) in
[mockk/mockk#1211

#### New Contributors

- [@&#8203;rotilho](https://togithub.com/rotilho) made their first
contribution in
[mockk/mockk#1202
- [@&#8203;jselbo](https://togithub.com/jselbo) made their first
contribution in
[mockk/mockk#1204
- [@&#8203;ath0s](https://togithub.com/ath0s) made their first
contribution in
[mockk/mockk#1209
- [@&#8203;JakeSteam](https://togithub.com/JakeSteam) made their first
contribution in
[mockk/mockk#1211

**Full Changelog**:
mockk/mockk@1.13.9...1.13.10

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 3am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/kotest/kotest).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMjAuMiIsInVwZGF0ZWRJblZlciI6IjM3LjIyNy4yIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants