-
-
Notifications
You must be signed in to change notification settings - Fork 332
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.util.ServiceConfigurationError while mocking classes instance methods for Kotlin 1.2.21 #22
Comments
Very nice trace :-) will check it later. Thanks
8 февр. 2018 г. 4:05 PM пользователь "tomkoptel" <notifications@github.com>
написал:
… Hello,
I am reproducing the following error when I am trying to mock the
android.database.Cursor.
java.util.ServiceConfigurationError: kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition: Provider kotlin.reflect.jvm.internal.impl.load.java.JavaIncompatibilityRulesOverridabilityCondition could not be instantiated
class SomeTest {
val c = mockk<Cursor>()
@test
fun name() {
every { c.getColumnIndex(any()) } returns 1
}
}
Full stacktrace:
com.intellij.rt.execution.application.AppMainV2 com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 com.showmax.lib.download.downloader.SomeTesrt
java.util.ServiceConfigurationError: kotlin.reflect.jvm.internal.impl.resolve.ExternalOverridabilityCondition: Provider kotlin.reflect.jvm.internal.impl.load.java.JavaIncompatibilityRulesOverridabilityCondition could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1042)
at kotlin.collections.CollectionsKt___CollectionsKt.toMutableList(_Collections.kt:1075)
at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1066)
at kotlin.reflect.jvm.internal.impl.resolve.OverridingUtil.<clinit>(OverridingUtil.java:45)
at kotlin.reflect.jvm.internal.impl.load.java.components.DescriptorResolverUtils.resolveOverrides(DescriptorResolverUtils.java:67)
at kotlin.reflect.jvm.internal.impl.load.java.components.DescriptorResolverUtils.resolveOverridesForNonStaticMembers(DescriptorResolverUtils.java:45)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaClassMemberScope.addFunctionFromSupertypes(LazyJavaClassMemberScope.kt:281)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaClassMemberScope.computeNonDeclaredFunctions(LazyJavaClassMemberScope.kt:245)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope$functions$1.invoke(LazyJavaScope.kt:89)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope$functions$1.invoke(LazyJavaScope.kt:51)
at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$MapBasedMemoizedFunction.invoke(LockBasedStorageManager.java:402)
at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$MapBasedMemoizedFunctionToNotNull.invoke(LockBasedStorageManager.java:470)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope.getContributedFunctions(LazyJavaScope.kt:224)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaClassMemberScope.getContributedFunctions(LazyJavaClassMemberScope.kt:654)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaClassMemberScope.getFunctionsFromSupertypes(LazyJavaClassMemberScope.kt:370)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaClassMemberScope.computeNonDeclaredFunctions(LazyJavaClassMemberScope.kt:241)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope$functions$1.invoke(LazyJavaScope.kt:89)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope$functions$1.invoke(LazyJavaScope.kt:51)
at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$MapBasedMemoizedFunction.invoke(LockBasedStorageManager.java:402)
at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$MapBasedMemoizedFunctionToNotNull.invoke(LockBasedStorageManager.java:470)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope.getContributedFunctions(LazyJavaScope.kt:224)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaClassMemberScope.getContributedFunctions(LazyJavaClassMemberScope.kt:654)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope.computeDescriptors(LazyJavaScope.kt:326)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope$allDescriptors$1.invoke(LazyJavaScope.kt:57)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope$allDescriptors$1.invoke(LazyJavaScope.kt:51)
at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:323)
at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:364)
at kotlin.reflect.jvm.internal.impl.load.java.lazy.descriptors.LazyJavaScope.getContributedDescriptors(LazyJavaScope.kt:305)
at kotlin.reflect.jvm.internal.impl.resolve.scopes.ResolutionScope$DefaultImpls.getContributedDescriptors$default(ResolutionScope.kt:37)
at kotlin.reflect.jvm.internal.KDeclarationContainerImpl.getMembers(KDeclarationContainerImpl.kt:61)
at kotlin.reflect.jvm.internal.KClassImpl$Data$declaredNonStaticMembers$2.invoke(KClassImpl.kt:139)
at kotlin.reflect.jvm.internal.KClassImpl$Data$declaredNonStaticMembers$2.invoke(KClassImpl.kt:39)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getDeclaredNonStaticMembers(KClassImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl$Data$allNonStaticMembers$2.invoke(KClassImpl.kt:148)
at kotlin.reflect.jvm.internal.KClassImpl$Data$allNonStaticMembers$2.invoke(KClassImpl.kt:39)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getAllNonStaticMembers(KClassImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl$Data$allMembers$2.invoke(KClassImpl.kt:154)
at kotlin.reflect.jvm.internal.KClassImpl$Data$allMembers$2.invoke(KClassImpl.kt:39)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getAllMembers(KClassImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl.getMembers(KClassImpl.kt:169)
at kotlin.reflect.full.KClasses.getFunctions(KClasses.kt:90)
at kotlin.reflect.jvm.ReflectJvmMapping.getKotlinFunction(ReflectJvmMapping.kt:137)
at io.mockk.impl.instantiation.JvmMockFactoryHelper.varArgPosition(JvmMockFactoryHelper.kt:53)
at io.mockk.impl.instantiation.JvmMockFactoryHelper.toDescription(JvmMockFactoryHelper.kt:69)
at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invoke(JvmMockFactoryHelper.kt:16)
at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invoke(JvmMockFactoryHelper.kt:12)
at io.mockk.impl.instantiation.JvmMockFactoryKt$sam$MockKInvocationHandler$4dff1f07.invocation(JvmMockFactory.kt)
at io.mockk.proxy.MockKProxyInterceptor.intercept(MockKProxyInterceptor.java:20)
at android.database.Cursor$ByteBuddy$p9JdW6Uq$ByteBuddy$kCWr7SV9.getColumnIndex(Unknown Source)
at com.showmax.lib.download.downloader.SomeTesrt$name$1.invoke(SomeTesrt.kt:22)
at com.showmax.lib.download.downloader.SomeTesrt$name$1.invoke(SomeTesrt.kt:17)
at io.mockk.impl.eval.RecordedBlockEvaluator$record$block$1.invoke(RecordedBlockEvaluator.kt:22)
at io.mockk.impl.recording.JvmAutoHinter.autoHint(JvmAutoHinter.kt:23)
at io.mockk.impl.eval.RecordedBlockEvaluator.record(RecordedBlockEvaluator.kt:31)
at io.mockk.impl.eval.EveryBlockEvaluator.every(EveryBlockEvaluator.kt:25)
at com.showmax.lib.download.downloader.SomeTesrt.name(SomeTesrt.kt:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:488)
at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:209)
at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:109)
at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:36)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:63)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)
Caused by: java.lang.InstantiationException: kotlin.reflect.jvm.internal.impl.load.java.JavaIncompatibilityRulesOverridabilityCondition
at java.lang.Class.newInstance(Class.java:427)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 93 more
Caused by: java.lang.NoSuchMethodException: kotlin.reflect.jvm.internal.impl.load.java.JavaIncompatibilityRulesOverridabilityCondition.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
... 94 more
Process finished with exit code 255
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#22>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFAbjIA11oABXDqa6Izd8atMaNGIXziSks5tSw0xgaJpZM4R-fy3>
.
|
@oleksiyp I have reproduced issue once again. In the end it is not related to the I do suspect that this snippet contributed to the issue: kapt {
correctErrorTypes = true
useBuildCache = true
} |
Ok, I found the culprit :D
|
I am still setting up android studio coz my laptop is after repair. I already were fixing something similar with an exception handler in vararg detection(see it in stacktrace). Thank you for na |
...UI hanged... Thank you for nailing it. I am more than sure it is related to a Kotlin runtime. There is few known issues with reflection |
@tomkoptel I'm trying to reproduce it in Android studio. Without any luck. Can you send me the minimal project you have issues with? Also what MockK version are you using? Last one is I was fixing varArgPosition (mentioned in stack trace) in 1.7.1:
|
I think this problem should be resolved in |
I did bumped version of Kotlin to ./gradlew clean
./gradlew --stop Still a stacktrace from AS 3.0.1. I hope it will help.
|
@oleksiyp hi, I tried to reproduce the issue on clean project setup with Kotlin I can see the stack trace posted above in another project I am currently working on. I am not able to identify what part of my environment setup screws the process. Do you have any ideas how can I help you to identify the issue? |
I actually know how to apply workaround it, but not how to reproduce :-)
just put wider exception handler on varArgPosition. I am already were
fixing similar issue here
80e6770#diff-8023bc8a31e015e5c7630498c9b86745R57
The reason for that is some problems in reflection library in Kotlin I
believe. Let me try to apply workaround today in the evening.
12 февр. 2018 г. 10:56 AM пользователь "tomkoptel" <notifications@github.com>
написал:
… @oleksiyp <https://github.com/oleksiyp> hi, I tried to reproduce the
issue on clean project setup with Kotlin 1.2.21 and mockk to 1.7.3. The
result that is not reproducible in the project from scratch.
I can see the stack trace posted above
<#22 (comment)> in
another project I am currently working on. I am not able to identify what
part of my environment setup screws the process.
Do you have any ideas how can I help you to identify the issue?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFAbjDgA7I-nLMUnszcJfD0M1ppkJi0_ks5tUArKgaJpZM4R-fy3>
.
|
Please try 1.7.4 if it fixes the issue |
What did I do?./gradlew clean
./gradlew sync
OutcomeWith Kotlin |
Hello,
I am reproducing the following error when I am trying to mock the
android.database.Cursor
.Full stacktrace:
The text was updated successfully, but these errors were encountered: