Hey guys, I have been coming across a particular ...
# android
a
Hey guys, I have been coming across a particular type of issue when writing unit tests in Kotlin. My module contains Java classes as well as Kotlin classes, and my class contains references to android classes which I intend to stub in my test. I get these weird "Exception while analyzing expression" exceptions when I run my tests. I get these issues only in one of my modules, and I haven't been able to replicate the issue on a sample project so far. Heres the stacktrace:
Copy code
e: org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression in (70,13) in 

Attachments:
causeThrowable
java.lang.AssertionError: deserialized class MutableCollection and Lazy Java class java.util.Collection should have same number of type parameters, but 1 / 0 found
	at org.jetbrains.kotlin.builtins.jvm.MappingUtilKt.createMappedTypeParametersSubstitution(mappingUtil.kt:14)
	at org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor$LazyJavaClassTypeConstructor.computeSupertypes(LazyJavaClassDescriptor.kt:238)
Way down below in the stack trace I see something like this:
Copy code
----
expression.kt
add(viewRootOne)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.logOrThrowException(ExpressionTypingVisitorDispatcher.java:261)
The line of code being referenced is just an addition to a mutable list. Any help would be appreciated. Thanks!
🧵 4