-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using categories in the def file to reintroduce methods in the …
…class ^KT-71624
- Loading branch information
1 parent
b1504e7
commit cc0919d
Showing
11 changed files
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
.../native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke5/contents.gold.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
library { | ||
// module name: <dependency.def> | ||
|
||
library fragment { | ||
// package name: dependency | ||
|
||
// class name: dependency/MyClass | ||
// class name: dependency/MyClass.Companion | ||
// class name: dependency/MyClassMeta | ||
// class name: dependency/MyProtocolProtocol | ||
// class name: dependency/MyProtocolProtocolMeta | ||
|
||
@kotlinx/cinterop/ExternalObjCClass | ||
public open class dependency/MyClass : kotlinx/cinterop/ObjCObjectBase { | ||
|
||
protected /* secondary */ constructor() | ||
|
||
// companion object: Companion | ||
|
||
// nested class: Companion | ||
} | ||
|
||
public final companion object dependency/MyClass.Companion : dependency/MyClassMeta, kotlinx/cinterop/ObjCClassOf<dependency/MyClass> { | ||
|
||
private constructor() | ||
} | ||
|
||
@kotlinx/cinterop/ExternalObjCClass | ||
public open class dependency/MyClassMeta : kotlinx/cinterop/ObjCObjectBaseMeta { | ||
|
||
protected /* secondary */ constructor() | ||
} | ||
|
||
@kotlinx/cinterop/ExternalObjCClass(protocolGetter = "kniprot_dependency0_MyProtocol") | ||
public abstract interface dependency/MyProtocolProtocol : kotlinx/cinterop/ObjCObject { | ||
|
||
@kotlinx/cinterop/ObjCMethod(selector = "wasInMyClass", encoding = "v16@0:8", isStret = false) | ||
public abstract fun wasInMyClass(): kotlin/Unit | ||
} | ||
|
||
@kotlinx/cinterop/ExternalObjCClass(protocolGetter = "kniprot_dependency0_MyProtocol") | ||
public abstract interface dependency/MyProtocolProtocolMeta : kotlinx/cinterop/ObjCClass /* = kotlinx/cinterop/ObjCObjectMeta^ */ { | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
native/native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke5/dependency.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# In Apple frameworks methods are sometimes moved from class declaration into a protocol and the class conforms to the protocol in an extension | ||
# This is a binary incompatible change in cinterop klibs | ||
language = Objective-C | ||
modules=dependency4 | ||
objcClassesIncludingCategories = MyClass |
55 changes: 55 additions & 0 deletions
55
.../native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke6/contents.gold.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
library { | ||
// module name: <dependency.def> | ||
|
||
library fragment { | ||
// package name: dependency | ||
|
||
// class name: dependency/MyClass | ||
// class name: dependency/MyClass.Companion | ||
// class name: dependency/MyClassMeta | ||
// class name: dependency/MyProtocolProtocol | ||
// class name: dependency/MyProtocolProtocolMeta | ||
|
||
@kotlinx/cinterop/ExternalObjCClass | ||
public open class dependency/MyClass : kotlinx/cinterop/ObjCObjectBase { | ||
|
||
protected /* secondary */ constructor() | ||
|
||
@kotlinx/cinterop/ObjCMethod(selector = "wasInMyClass", encoding = "v16@0:8", isStret = false) | ||
public open external fun wasInMyClass(): kotlin/Unit | ||
|
||
// companion object: Companion | ||
|
||
// nested class: Companion | ||
} | ||
|
||
public final companion object dependency/MyClass.Companion : dependency/MyClassMeta, kotlinx/cinterop/ObjCClassOf<dependency/MyClass> { | ||
|
||
private constructor() | ||
} | ||
|
||
@kotlinx/cinterop/ExternalObjCClass | ||
public open class dependency/MyClassMeta : kotlinx/cinterop/ObjCObjectBaseMeta { | ||
|
||
protected /* secondary */ constructor() | ||
} | ||
|
||
@kotlinx/cinterop/ExternalObjCClass(protocolGetter = "kniprot_dependency0_MyProtocol") | ||
public abstract interface dependency/MyProtocolProtocol : kotlinx/cinterop/ObjCObject { | ||
|
||
@kotlinx/cinterop/ObjCMethod(selector = "wasInMyClass", encoding = "v16@0:8", isStret = false) | ||
public abstract fun wasInMyClass(): kotlin/Unit | ||
} | ||
|
||
@kotlinx/cinterop/ExternalObjCClass(protocolGetter = "kniprot_dependency0_MyProtocol") | ||
public abstract interface dependency/MyProtocolProtocolMeta : kotlinx/cinterop/ObjCClass /* = kotlinx/cinterop/ObjCObjectMeta^ */ { | ||
} | ||
|
||
package { | ||
|
||
@kotlinx/cinterop/ObjCMethod(selector = "wasInMyClass", encoding = "v16@0:8", isStret = false) | ||
@kotlin/Deprecated(message = "Use instance method instead", replaceWith = kotlin/ReplaceWith(imports = [], expression = ""), level = kotlin/DeprecationLevel.WARNING) | ||
public final external fun dependency/MyClass.wasInMyClass(): kotlin/Unit | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
native/native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke6/dependency.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# We use the category in the def file to add back the method | ||
language = Objective-C | ||
modules=dependency4 | ||
objcClassesIncludingCategories = MyClass | ||
allowIncludingObjCCategoriesFromDefFile = true | ||
--- | ||
@interface MyClass (K) | ||
-(void) wasInMyClass; | ||
@end |
9 changes: 9 additions & 0 deletions
9
.../testData/CInterop/frameworkIncludeCategories/dependency4.framework/Headers/dependency4.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@protocol MyProtocol | ||
-(void) wasInMyClass; | ||
@end | ||
|
||
@interface MyClass | ||
@end | ||
|
||
@interface MyClass () <MyProtocol> | ||
@end |
6 changes: 6 additions & 0 deletions
6
...stData/CInterop/frameworkIncludeCategories/dependency4.framework/Modules/module.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
framework module dependency4 { | ||
umbrella header "dependency4.h" | ||
|
||
export * | ||
module * { export * } | ||
} |
12 changes: 12 additions & 0 deletions
12
...-gen/org/jetbrains/kotlin/konan/test/blackbox/CInteropIncludeCategoriesTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters