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

java.lang.RuntimeException: Could not find a way to get a reference of MySealedInterface #56

Closed
ankushg opened this issue Apr 13, 2023 · 3 comments

Comments

@ankushg
Copy link
Contributor

ankushg commented Apr 13, 2023

I'm running into issues with sealed interfaces and sealed classes when attempting to match in a Mock with isAny()

The stacktrace is coming from ArgConstraintsBuilder.toReturn

which calls References.getReference
which calls cls.isInstance(ref) which seems eventually seems to throw an error for sealed interfaces from validateProxyInterfaces

I've worked around it for now by rewriting tests to just explicitly assert equality instead of using isAny(), but this should probably at least be documented 😅

@motorro
Copy link

motorro commented May 6, 2023

@ankushg did you upgrade to AGP8 and Java17?
I had my tests running but upgraded dependencies and it seems that matters.
Haven't done proper git bisecting yet but I suspect the issue is there as I didn't change any sources

@motorro
Copy link

motorro commented May 6, 2023

Confirmed. Reverting to:

  • Gradle 7.5 from 8.0
  • AGP 7.4.1 from 8.0
  • Compile options, sourceCompatibility VERSION_17 to VERSION 1_8
  • Kotlin options jvmTarget "17" to "1.8"
    Fixes tests

@SalomonBrys
Copy link
Member

Fix released in v1.14.0.

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

No branches or pull requests

3 participants