Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applications 增加部分Java友好API #535

Merged
merged 4 commits into from
Dec 5, 2022
Merged

Conversation

ForliyScarlet
Copy link
Member

Applications 增加部分Java友好API。

注意:这可能是不兼容的。

旧API中可能存在大量Lambda表达式是需要返回 Unit.INSTANCE 或者需要通过 Lambdas 来获取一个 suspend 兼容函数的,例如

Applications.createSimbotApplication(
    Simple.INSTANCE, 
    (config) -> Unit.INSTANCE,
    Lambdas.suspendConsumer((b, c) -> {})
)

更新后则可以使用与Java Lambda相近的方式:

Applications.createSimbotApplication(
    Simple.INSTANCE,
    (c) -> {}, 
    (b, c) -> {
        // ...
    });

但是旧方法将不再支持(兼容),因此这有可能是二进制不兼容的。

Applications.simbotApplication(...) 同理。

Applications.buildSimbotApplication 所得到的 ApplicationDslBuilder 中的API有所调整,其 configbuild API将会提供Java友好的Lambda使用方式。

但是,其中 config 的参数类型被变更,因此说仅保证对Kotlin的源码兼容,且不是二进制兼容的。

@ForliyScarlet ForliyScarlet added 不兼容 不兼容的内容 特性 一个新特性,或者一个新的功能/能力 labels Dec 5, 2022
@ForliyScarlet ForliyScarlet merged commit 8bfbccd into v3-dev Dec 5, 2022
@ForteScarlet ForteScarlet deleted the app_override branch December 5, 2022 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
不兼容 不兼容的内容 特性 一个新特性,或者一个新的功能/能力
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants