Error: Declaration annotated with @OptionalExpectation can only be used in common module sources

我与影子孤独终老i 提交于 2021-01-29 13:24:52

问题


Update (2018-11-03)

This is a known issue that is being tracked here.

Original Post

I am playing around with Kotlin MPP, specifically with Kotlin 1.3 and the new structure. After converting a Kotlin 1.2 MPP to the new structure, I keep getting these errors:

Error:(3, 18) Kotlin: [MPP_jvmMain] Declaration annotated with '@OptionalExpectation' can only be used in common module sources

These are referring to the @JsName() annotations I have within my common module.

I have tried:

  • Starting a completely new MPP from scratch using the built-in wizard, and simply adding @JsName("test") to the hello() function that comes with the generated sample. Even that seems to cause problems.
  • Invalidating caches/restarting IntelliJ
  • Using the latest versions of everything (Kotlin 1.3, IntelliJ IDEA 2018.2.5 Ultimate)
  • Calling ./gradlew build from the command line. This works.

Sample project here

Link Kotlin Issue


回答1:


This was fixed within v1.3.10 of the Kotlin plugin for IntelliJ.



来源:https://stackoverflow.com/questions/53216175/error-declaration-annotated-with-optionalexpectation-can-only-be-used-in-commo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!