[FIR] Create fake hidden versions of List.getFirst/getLast in JDK < 21
... so that overrides are marked as deprecated regardless of the JDK. #KT-65440 Fixed
This commit is contained in:
committed by
Space Team
parent
c6b2675089
commit
2f49272c42
+1
@@ -62,6 +62,7 @@ internal tailrec fun FirDeclaration.ktSymbolOrigin(): KtSymbolOrigin = when (ori
|
||||
FirDeclarationOrigin.Enhancement -> KtSymbolOrigin.JAVA
|
||||
FirDeclarationOrigin.IntersectionOverride -> KtSymbolOrigin.INTERSECTION_OVERRIDE
|
||||
FirDeclarationOrigin.Delegated -> KtSymbolOrigin.DELEGATED
|
||||
FirDeclarationOrigin.Synthetic.FakeHiddenInPreparationForNewJdk -> KtSymbolOrigin.LIBRARY
|
||||
is FirDeclarationOrigin.Synthetic -> {
|
||||
when {
|
||||
source?.kind == KtFakeSourceElementKind.DataClassGeneratedMembers -> KtSymbolOrigin.SOURCE_MEMBER_GENERATED
|
||||
|
||||
+4
@@ -45,3 +45,7 @@ open operator fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
open fun hashCode(): kotlin.Int
|
||||
|
||||
open fun toString(): kotlin.String
|
||||
|
||||
fun getFirst(): E
|
||||
|
||||
fun getLast(): E
|
||||
+82
@@ -1546,4 +1546,86 @@ KtFunctionSymbol:
|
||||
getContainingFileSymbol: null
|
||||
getContainingJvmClassName: kotlin.Any
|
||||
getContainingModule: KtBinaryModule "Builtins for JVM (1.8)"
|
||||
deprecationStatus: null
|
||||
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/collections/MutableList.getFirst
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isActual: false
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExpect: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: getFirst
|
||||
origin: SUBSTITUTION_OVERRIDE
|
||||
receiverParameter: null
|
||||
returnType: KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
getDispatchReceiver(): KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
]
|
||||
type: kotlin/collections/MutableList<E>
|
||||
getContainingFileSymbol: null
|
||||
getContainingJvmClassName: kotlin.collections.MutableList
|
||||
getContainingModule: KtBinaryModule "Builtins for JVM (1.8)"
|
||||
deprecationStatus: null
|
||||
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/collections/MutableList.getLast
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isActual: false
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExpect: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: getLast
|
||||
origin: SUBSTITUTION_OVERRIDE
|
||||
receiverParameter: null
|
||||
returnType: KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
getDispatchReceiver(): KtUsualClassType:
|
||||
annotationsList: []
|
||||
ownTypeArguments: [
|
||||
KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
]
|
||||
type: kotlin/collections/MutableList<E>
|
||||
getContainingFileSymbol: null
|
||||
getContainingJvmClassName: kotlin.collections.MutableList
|
||||
getContainingModule: KtBinaryModule "Builtins for JVM (1.8)"
|
||||
deprecationStatus: null
|
||||
+5
@@ -13,6 +13,8 @@ val size: kotlin.Int
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
fun getFirst(): kotlin.Int
|
||||
fun getLast(): kotlin.Int
|
||||
|
||||
|
||||
Declaration Scope:
|
||||
@@ -30,3 +32,6 @@ val size: kotlin.Int
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
fun getFirst(): E
|
||||
fun getLast(): E
|
||||
|
||||
|
||||
+68
@@ -148,6 +148,18 @@ KtFunctionLikeSignature:
|
||||
symbol = kotlin/Any.toString(<dispatch receiver>: kotlin.Any): kotlin.String
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = kotlin/Any.toString
|
||||
KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = kotlin/collections/List.getFirst(<dispatch receiver>: kotlin.collections.List<E>): E
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = kotlin/collections/List.getFirst
|
||||
KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Int
|
||||
symbol = kotlin/collections/List.getLast(<dispatch receiver>: kotlin.collections.List<E>): E
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = kotlin/collections/List.getLast
|
||||
|
||||
|
||||
Declaration Scope:
|
||||
@@ -798,4 +810,60 @@ KtFunctionSymbol:
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/collections/List.getFirst
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isActual: false
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExpect: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: getFirst
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/collections/List.getLast
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isActual: false
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExpect: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: getLast
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
|
||||
+5
@@ -13,6 +13,8 @@ val size: kotlin.Int
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
fun getFirst(): AAA
|
||||
fun getLast(): AAA
|
||||
|
||||
|
||||
Declaration Scope:
|
||||
@@ -30,3 +32,6 @@ val size: kotlin.Int
|
||||
fun equals(other: kotlin.Any?): kotlin.Boolean
|
||||
fun hashCode(): kotlin.Int
|
||||
fun toString(): kotlin.String
|
||||
fun getFirst(): E
|
||||
fun getLast(): E
|
||||
|
||||
|
||||
+68
@@ -148,6 +148,18 @@ KtFunctionLikeSignature:
|
||||
symbol = kotlin/Any.toString(<dispatch receiver>: kotlin.Any): kotlin.String
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = kotlin/Any.toString
|
||||
KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = AAA
|
||||
symbol = kotlin/collections/List.getFirst(<dispatch receiver>: kotlin.collections.List<E>): E
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = kotlin/collections/List.getFirst
|
||||
KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = AAA
|
||||
symbol = kotlin/collections/List.getLast(<dispatch receiver>: kotlin.collections.List<E>): E
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = kotlin/collections/List.getLast
|
||||
|
||||
|
||||
Declaration Scope:
|
||||
@@ -798,4 +810,60 @@ KtFunctionSymbol:
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/collections/List.getFirst
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isActual: false
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExpect: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: getFirst
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
KtFunctionSymbol:
|
||||
annotationsList: []
|
||||
callableIdIfNonLocal: kotlin/collections/List.getLast
|
||||
contextReceivers: []
|
||||
contractEffects: []
|
||||
hasStableParameterNames: true
|
||||
isActual: false
|
||||
isBuiltinFunctionInvoke: false
|
||||
isExpect: false
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
isInfix: false
|
||||
isInline: false
|
||||
isOperator: false
|
||||
isOverride: false
|
||||
isStatic: false
|
||||
isSuspend: false
|
||||
modality: OPEN
|
||||
name: getLast
|
||||
origin: LIBRARY
|
||||
receiverParameter: null
|
||||
returnType: KtTypeParameterType:
|
||||
annotationsList: []
|
||||
type: E
|
||||
symbolKind: CLASS_MEMBER
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
|
||||
+6
@@ -38708,6 +38708,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava17"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("newListMethods.kt")
|
||||
public void testNewListMethods() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava17/newListMethods.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -38708,6 +38708,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava17"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("newListMethods.kt")
|
||||
public void testNewListMethods() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava17/newListMethods.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user