ObjCExport: deprecate exporting data class componentN methods to Obj-C
The Objective-C methods for Kotlin data class componentN methods shouldn't have been generated in the first place -- the corresponding Kotlin methods are required to make the destructuring work in Kotlin, and don't help in Objective-C or Swift. Calling them manually from Objective-C or Swift doesn't make much sense. So now we deprecate this, in order to remove these methods from Objective-C header completely later. ^KT-42641 ^KT-49516 Fixed
This commit is contained in:
committed by
Space
parent
4636f71076
commit
ad72545647
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
import Kt
|
||||
|
||||
private func testComponentMethodsAreStillAccessible() throws {
|
||||
let d = DataClassWithComponentMethods(x: 1, y: 2)
|
||||
try assertEquals(actual: d.component1(), expected: 1)
|
||||
try assertEquals(actual: d.component2(), expected: 2)
|
||||
}
|
||||
|
||||
// Absence of deprecation attributes is checked by comparing "lazy header".
|
||||
private func testRegularComponentMethodsAreAccessible() throws {
|
||||
let r = RegularClassWithComponentMethods()
|
||||
try assertEquals(actual: r.component1(), expected: 3)
|
||||
try assertEquals(actual: r.component3(), expected: 4)
|
||||
}
|
||||
|
||||
private func testTopLevelComponentMethodsAreAccessible() throws {
|
||||
try assertEquals(actual: DataClassComponentMethodsKt.component1(), expected: 5)
|
||||
try assertEquals(actual: DataClassComponentMethodsKt.component4(), expected: 6)
|
||||
}
|
||||
|
||||
class DataClassComponentMethodsTests : SimpleTestProvider {
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
test("testComponentMethodsAreStillAccessible", testComponentMethodsAreStillAccessible)
|
||||
test("testRegularComponentMethodsAreAccessible", testRegularComponentMethodsAreAccessible)
|
||||
test("testTopLevelComponentMethodsAreAccessible", testTopLevelComponentMethodsAreAccessible)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user