elihart
10/27/2021, 2:26 AMCaused by: java.lang.IllegalArgumentException: EpoxyModel<*> is not a sub type of the class/interface that contains `equals` (EpoxyModel)
at com.google.devtools.ksp.processing.impl.ResolverImpl.computeAsMemberOf(ResolverImpl.kt:972)
at com.google.devtools.ksp.processing.impl.ResolverImpl.asMemberOf$compiler_plugin(ResolverImpl.kt:954)
at com.google.devtools.ksp.symbol.impl.java.KSFunctionDeclarationJavaImpl.asMemberOf(KSFunctionDeclarationJavaImpl.kt:124)
at androidx.room.compiler.processing.ksp.KSAsMemberOfKt.typeAsMemberOf(KSAsMemberOf.kt:67)
at androidx.room.compiler.processing.ksp.KspExecutableParameterElement$type$2.invoke(KspExecutableParameterElement.kt:44)
at androidx.room.compiler.processing.ksp.KspExecutableParameterElement$type$2.invoke(KspExecutableParameterElement.kt:43)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at androidx.room.compiler.processing.ksp.KspExecutableParameterElement.getType(KspExecutableParameterElement.kt:43)
at androidx.room.compiler.processing.ksp.KspExecutableParameterElement.getType(KspExecutableParameterElement.kt:26)
This happens when I access a certain`XVariableElement.type` , which is a parameter of a function inside my EpoxyModel<T> class. There seems to be a bug with how the generics are handled, but I can’t tell if it is something XProcessing is doing wrong or KSP itself.
What is strange is that when ResolverImpl.computeAsMemberOf
fails the check for containing.kotlinType.isSubtypeOf(functionDeclaredIn)
it doesn’t consider EpoxyModel<*>
as a subclass of EpoxyModel
. I have tried to reproduce this in a unit test, and can’t so far, because other cases like ArrayList<*>
vs ArrayList
work fine.
Digging deeper into it, the isSubtypeOf
function ends up comparing two LazyJavaClassDescriptor
instances representing the same class, but that type doesn’t seem to implement “equals” so because they are different instances the check fails.it
seems like it should match the classDeclaration
, but the ==
still failsyigit
10/27/2021, 2:28 AMelihart
10/27/2021, 2:28 AMfinish
when the types were saved in a list from the previous round.
wow, that must be it. Thanks @yigit for identifying in a few seconds what I’ve been banging my head on for a few hours 😭
ouchyigit
10/27/2021, 2:33 AMelihart
10/27/2021, 2:35 AMJiaxiang
10/27/2021, 6:13 AMelihart
10/27/2021, 4:36 PM