Files
kotlin-fork/compiler/testData/codegen/reflection
Vsevolod Tolstopyatov b29309478e Take into account 'KTypeImpl.classifier' in its hashCode and equals
Since KT-53308, we started to cache results of typeOf invocation
in reflection. The cache uses the origin 'KClassifier' as a key with
an optional list of 'KTypeProjection' in type argument position,
and computed result as a value.

Without classifier check, the caching produces incorrect execution in
a very specific classloaders usage which is leveraged
by IDEA source-tree:

* All Kotlin stdlib and reflect classes are always loaded by the same
  classloader
* Other classes that depend on Kotlin are loaded by separate
  classloaders

The reproducer:

* Attempt to use typeOf<kotlin.List<Foo>> from one classloader caches
  the resulting KType
* Attempt to use typeOf<kotlin.List<Foo>> from another classloader
  for the same 'Foo' that differs only in classloader reuses the
  computed KType, meaning that KType type argument classifier
  is simply incorrect and points to the 'Foo' from the first classloader

#KT-54611 Fixed
#KT-54629 Fixed

Merge-request: KT-MR-7470
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-10-24 19:05:08 +00:00
..