JVM_IR KT-46562 don't use LambdaMetafactory for Serializable SAMs

TODO support serializable lambdas creation with LambdaMetafactory
This commit is contained in:
Dmitry Petrov
2021-05-10 14:52:46 +03:00
parent bdfc879f00
commit ac0aaff611
8 changed files with 143 additions and 1 deletions
@@ -143,8 +143,24 @@ private fun collectAllSupertypes(irType: IrSimpleType, result: MutableSet<IrSimp
// for the class C, this function constructs:
// { B<List<Z>>, A<List<List<Z>>, Any }
// where Z is a type parameter of class C.
fun getAllSubstitutedSupertypes(irClass: IrClass): MutableSet<IrSimpleType> {
fun getAllSubstitutedSupertypes(irClass: IrClass): Set<IrSimpleType> {
val result = HashSet<IrSimpleType>()
collectAllSupertypes(irClass.defaultType, result)
return result
}
private fun collectAllSuperclasses(irClass: IrClass, set: MutableSet<IrClass>) {
for (superType in irClass.superTypes) {
val classifier = superType.classifierOrNull as? IrClassSymbol ?: continue
val superClass = classifier.owner
if (set.add(superClass)) {
collectAllSuperclasses(superClass, set)
}
}
}
fun IrClass.getAllSuperclasses(): Set<IrClass> {
val result = HashSet<IrClass>()
collectAllSuperclasses(this, result)
return result
}