Kotlin / kotlinx-kover

Apache License 2.0
1.37k stars 53 forks source link

wrong coverage percent 0.7.4 to 0.7.6 #562

Open jiwhunkim opened 8 months ago

jiwhunkim commented 8 months ago

using 0.7.4 kover code coverage work properly after 0.7.4 version using code coverage show 0%

I found coverage-error.log (0.7.6)

[2024.03.12 18:09:36] (Coverage INFO): Error during class frame computation: com/appmattus/kotlinfixture/resolver/AndroidUriResolver com.intellij.rt.coverage.instrumentation.ClassWriterImpl$FrameComputationClassNotFoundException: Class android/net/Uri not found at com.intellij.rt.coverage.instrumentation.ClassWriterImpl.getOrLoadClassReader(ClassWriterImpl.java:131) at com.intellij.rt.coverage.instrumentation.ClassWriterImpl.getCommonSuperClass(ClassWriterImpl.java:43) at org.jetbrains.coverage.org.objectweb.asm.SymbolTable.addMergedType(SymbolTable.java:1202) at org.jetbrains.coverage.org.objectweb.asm.Frame.merge(Frame.java:1300) at org.jetbrains.coverage.org.objectweb.asm.Frame.merge(Frame.java:1245) at org.jetbrains.coverage.org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1611) at org.jetbrains.coverage.org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1547) at org.jetbrains.coverage.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:786) at org.jetbrains.coverage.org.objectweb.asm.commons.LocalVariablesSorter.visitMaxs(LocalVariablesSorter.java:147) at com.intellij.rt.coverage.instrumentation.util.LocalVariableInserter.visitMaxs(LocalVariableInserter.java:54) at org.jetbrains.coverage.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:786) at org.jetbrains.coverage.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:786) at org.jetbrains.coverage.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:767) at com.intellij.rt.coverage.instrumentation.CoverageEnumerator.accept(CoverageEnumerator.java:62) at com.intellij.rt.coverage.instrumentation.Instrumenter$2.visitEnd(Instrumenter.java:120) at org.jetbrains.coverage.org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1519) at org.jetbrains.coverage.org.objectweb.asm.ClassReader.accept(ClassReader.java:745) at org.jetbrains.coverage.org.objectweb.asm.ClassReader.accept(ClassReader.java:425) at com.intellij.rt.coverage.instrumentation.AbstractIntellijClassfileTransformer.instrument(AbstractIntellijClassfileTransformer.java:132) at com.intellij.rt.coverage.instrumentation.AbstractIntellijClassfileTransformer.transform(AbstractIntellijClassfileTransformer.java:88) at com.intellij.rt.coverage.instrumentation.AbstractIntellijClassfileTransformer.transformInner(AbstractIntellijClassfileTransformer.java:102) at com.intellij.rt.coverage.instrumentation.AbstractIntellijClassfileTransformer.transform(AbstractIntellijClassfileTransformer.java:57) at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244) at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188) at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) at com.appmattus.kotlinfixture.config.Configuration.<clinit>(Configuration.kt:122) at com.appmattus.kotlinfixture.config.ConfigurationBuilder.<init>(ConfigurationBuilder.kt:40) at com.appmattus.kotlinfixture.KotlinFixtureKt.kotlinFixture(KotlinFixture.kt:102) at com.baemin.mart.order.adapter.conversion.OrderConvertSettlementAdapterSpec.<clinit>(OrderConvertSettlementAdapterSpec.kt:118) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:375) at io.kotest.framework.discovery.Discovery$loadSelectedSpecs$loadedClasses$2.invoke(Discovery.kt:158) at io.kotest.framework.discovery.Discovery$loadSelectedSpecs$loadedClasses$2.invoke(Discovery.kt:158) at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210) at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170) at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194) at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:816) at io.kotest.framework.discovery.Discovery.loadSelectedSpecs(Discovery.kt:160) at io.kotest.framework.discovery.Discovery.doDiscovery-IoAF18A(Discovery.kt:99) at io.kotest.framework.discovery.Discovery.discover(Discovery.kt:73) at io.kotest.runner.junit.platform.KotestJunitPlatformTestEngine.discover(KotestJunitPlatformTestEngine.kt:122) at io.kotest.runner.junit.platform.KotestJunitPlatformTestEngine.discover(KotestJunitPlatformTestEngine.kt:39) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78) at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:99) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85) at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47) at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:118) at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:93) at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:88) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33) at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94) at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193) at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129) at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100) at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60) at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56) at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113) at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65) at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69) at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

shanshin commented 8 months ago

Hi, could you please provide a small reproducer project?

jiwhunkim commented 8 months ago

I think main reason reproduce project like https://github.com/jiwhunkim/helloworld-hexagonal-architecture

maybe below log

[2024.03.15 10:22:22] (Coverage WARN): Unexpected error during report saving java.lang.NullPointerException: Cannot invoke "com.intellij.rt.coverage.data.ClassData.getName()" because "targetClassData" is null at com.intellij.rt.coverage.util.LineMapper.mapLines(LineMapper.java:75) at com.intellij.rt.coverage.data.ClassData.checkLineMappings(ClassData.java:223) at com.intellij.rt.coverage.data.ProjectData.applyLineMappings(ProjectData.java:243) at com.intellij.rt.coverage.util.CoverageReport.finalizeCoverage(CoverageReport.java:100) at com.intellij.rt.coverage.util.CoverageReport.save(CoverageReport.java:66) at com.intellij.rt.coverage.instrumentation.Instrumentator$1.run(Instrumentator.java:88) at java.base/java.lang.Thread.run(Thread.java:833)

jiwhunkim commented 8 months ago

coverage-error-0.8.0-Beta.log coverage-error-0.7.3.log

tatocaster commented 8 months ago

same is happening on 0.8.0-beta too ☝🏻 Basically I had to revert from 0.7.5(6) to 0.7.3, but it suffers from https://github.com/Kotlin/kotlinx-kover/issues/459. Eagerly waiting for 0.8.1 probably where coverage and verification will work together 🤞

Thanks