question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.12.5 fails to `every` certain java classes

See original GitHub issue

I created a demo/minimal project here:

https://gitlab.com/knyttl/mockkdemo/-/tree/main

You can see the CI build with test failure here:

https://gitlab.com/knyttl/mockkdemo/-/jobs/2782097977

Feel free to change the build.gradle.kts mockk version to 1.12.4 which will test correctly.

Expected Behavior

The tests shouldn’t fail.

Current Behavior

The test fails with:

kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Unresolved class: class org.elasticsearch.search.sort.SortOrder$1

As you can see in the CI run mentioned above.

Failure Information (for bugs)

See CI run mentioned above.

Steps to Reproduce

See the source code mentioned above. Feel free to change the version to 1.12.4 which will build correctly.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • MockK version: 1.12.5
  • Kotlin version: 1.7.10
  • JDK version: 17

Minimal reproducible code (the gist of this issue)

import io.mockk.every
import io.mockk.mockk
import org.elasticsearch.search.sort.SortOrder
import org.junit.jupiter.api.Test

class MockkDemo {
    @Test
    fun testMockk() {
        val repo = mockk<TestClass>()
        every { repo.getSchedules() } returns "Foo"
    }
}

class TestClass {
    fun getSchedules(sortOrder: SortOrder = SortOrder.ASC): String =
        sortOrder.toString()
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:10
  • Comments:37 (12 by maintainers)

github_iconTop GitHub Comments

7reactions
knyttlcommented, Jul 30, 2022

When will you release it?

1reaction
qoomoncommented, Sep 15, 2022

@aSemy however we are already catching KotlinReflectionInternalError. It seems KotlinReflectionInternalError can’t be catched.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mockk-io/Lobby - Gitter
Hi all, I wonder how to mock a method of a Java class with nullable type. ... Hi , today I upgrade my...
Read more >
How to Fix UnsupportedClassVersion Error in Java - Rollbar
The UnsupportedClassVersionError in Java occurs when the JVM attempts to read a malformed or otherwise erroneous class file.
Read more >
1.2. Why Programming? Why Java? - Runestone Academy
Every program in Java is written as a class. Java is an object-oriented language and we'll learn more about classes and objects in...
Read more >
OpenNMS Release Notes - OpenNMS Projects
Release 1.12.5 ... Outage timeline does not show all outages in timeframe (Issue NMS-7331) ... SVG Map: Clean Up Java Classes (Issue NMS-5013)....
Read more >
Release Notes - Geode - Apache Software Foundation
Fixed an issue affecting some classes when serializable ... Note: 1.12.5 cannot be upgraded to versions of Geode 1.13 prior to 1.13.2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found