5dc882abf5
... for Kotlin-generated classes which do not correspond to a "class" from the Kotlin language's point of view. For example, Kotlin lambdas, file facade classes, multifile class facade/part classes, WhenMappings, DefaultImpls. They can be distinguished from normal classes by the value of `KotlinClassHeader.Kind` (which is the same as `Metadata.kind`). Another theoretical option would be to throw exception at the point where the `::class` expression is used, if the expression's type on the left-hand side is a synthetic class. But we can't really do that since it'll affect performance of most `<expression>::class` expressions. So, construct a fake synthetic class instead, without any members except equals/hashCode/toString, and without any non-trivial modifiers. It kind of contradicts the general idea that kotlin-reflect presents anything exactly the same as the compiler sees it, but arguably it's worth it to avoid unexpected exceptions like in KT-41373. In the newly added test, Java lambda check is muted but it should work exactly the same as for Kotlin lambdas and other synthetic classes. It's fixed in a subsequent commit. #KT-41373 In Progress