diesieben07
11/09/2020, 9:27 PMclass MyModel : Model() {
val foo by IntField()
// this is generated by my plugin:
interface EntityI {
val foo: Int
}
}
Now I also want to generate the following companion object:
companion object : ModelCompanion<MyModel, EntityI>
I can create the companion object using SyntheticResolveExtension.getSyntheticCompanionObjectNameIfNeeded
, however inside addSyntheticSupertypes
for the companion object I cannot add the supertype, because EntityI
is not yet resolvable as a descriptor (trying to do so will report a recursion, which does make sense).
I understand I need to somehow create a lazy KotlinType (which seems to exist), but I have no idea how I would create it with what I have available in addSyntheticSupertypes
.
Any advice?shikasd
11/10/2020, 1:34 AMdiesieben07
11/12/2020, 11:19 AMMiguel Vera Belmonte
03/05/2021, 1:39 AMoverride fun addSyntheticSupertypes(thisDescriptor: ClassDescriptor, supertypes: MutableList<KotlinType>) {
val classDescriptor = thisDescriptor.module
.findClassAcrossModuleDependencies(ClassId(FqName("<package>"), Name.identifier("<className>")))
}