K2: Refine how JDK members are mapped to built-in classes

Previously, the semantic was more-or-less correct for most of the cases
but some corner one, like `sort` in MutableList didn't work properly.

Namely, `sort` should be marked there in a way to forbid to call it
everywhere beside super-calls.
Also, overriding it should be allowed.

Mostly, the logic was re-written to K2 model from K1-related
JvmBuiltInsCustomizer.

^KT-57694 In progress
^KT-57269 Fixed
This commit is contained in:
Denis.Zharkov
2023-04-13 11:50:54 +02:00
committed by Space Team
parent 161fe1d2ca
commit 2e5b783cc6
59 changed files with 1225 additions and 595 deletions
@@ -14,7 +14,7 @@ scopes:
SimpleTypeScope, index = 2
classifiers: 1
companion object
callables: 9
callables: 11
val x: kotlin.String
fun foo()
fun clone(): kotlin.Any
@@ -24,6 +24,8 @@ scopes:
fun toString(): kotlin.String
val name: kotlin.String
val ordinal: kotlin.Int
fun getDeclaringClass(): java.lang.Class<E?>?
fun finalize()
StaticMemberScope, index = 3
classifiers: 0
@@ -42,7 +42,7 @@ scopes:
symbolKind: CLASS_MEMBER
typeParameters: []
visibility: Public
callables: 9
callables: 11
KtKotlinPropertySymbol:
annotationsList: []
backingFieldSymbol: KtBackingFieldSymbol:
@@ -402,6 +402,59 @@ scopes:
symbolKind: CLASS_MEMBER
typeParameters: []
visibility: Public
KtFunctionSymbol:
annotationsList: []
callableIdIfNonLocal: /E.getDeclaringClass
contextReceivers: []
contractEffects: []
hasStableParameterNames: false
isBuiltinFunctionInvoke: false
isExtension: false
isExternal: false
isInfix: false
isInline: false
isOperator: false
isOverride: false
isStatic: false
isSuspend: false
modality: FINAL
name: getDeclaringClass
origin: SUBSTITUTION_OVERRIDE
receiverParameter: null
returnType: KtFlexibleType:
annotationsList: []
type: ft<java/lang/Class<E!>, java/lang/Class<E!>?>
symbolKind: CLASS_MEMBER
typeParameters: []
valueParameters: []
visibility: Public
KtFunctionSymbol:
annotationsList: []
callableIdIfNonLocal: kotlin/Enum.finalize
contextReceivers: []
contractEffects: []
hasStableParameterNames: false
isBuiltinFunctionInvoke: false
isExtension: false
isExternal: false
isInfix: false
isInline: false
isOperator: false
isOverride: false
isStatic: false
isSuspend: false
modality: FINAL
name: finalize
origin: JAVA
receiverParameter: null
returnType: KtUsualClassType:
annotationsList: []
ownTypeArguments: []
type: kotlin/Unit
symbolKind: CLASS_MEMBER
typeParameters: []
valueParameters: []
visibility: ProtectedAndPackage
StaticMemberScope, index = 3
classifiers: 0