This commit optimizes functions related to method signature mapping on
the JVM backend. The most significant change is avoiding re-allocations
in StringBuilder when building internal names. The commit also includes
minor optimizations, such as removing redundant allocations of strings
and other objects.
Implementation is very similar to the `enumValues` intrinsic.
Java enums and old (pre-1.9) Kotlin enums will be supported in a
subsequent commit.
#KT-59710
* [JVM_IR] Limit inner class attributes to types in class file
Inner class attributes should only be recorded for types that
are materialized in the result class file. In particular, we
should not emit inner classes attributes for types that appear
only in fake overrides. We do map these types to track the
fake overrides for JVM signature clashes but they are not
materialized in the class file.
^KT-56104 Fixed
* [JVM_IR] Consistently pass around materialized boolean in mapType.
As shown in (DEFALUT | GENERIC_ARGUMENT)_UAST, UAST's PsiType mapping
needs an automatic expansion of type alias. This commit makes utils that
generate optimal type mapping modes for return / parameter to consider
if this is used for UAST. In that case, utils will set `mapTypeAliases`
true so that typealias (even inside type arguments) can be expanded
properly.
It's incorrect to take the first parameter type from the expression
itself because it can be nullable if smart casts are used. And if it's
nullable, it's mapped to the wrapper type and calling
`comparisonOperandType` for it makes no sense. Instead, take the type
from the callee function, as it's guaranteed to be mapped to a JVM
primitive type.
E.g. in `test1` function in the added test, the problem was that the
dispatch receiver type of the call expression is `Double?`, which is
mapped to `java/lang/Double`, whereas we clearly wanted to obtain the
primitive `D` (double) type.
#KT-52163 Fixed
The counterparts in old FE don't have such restriction, so it can
map a type that has a flexible type as a type argument to JVM type,
e.g., Stream<String..String?>