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












0















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










share|improve this question





























    0















    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










    share|improve this question



























      0












      0








      0








      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










      share|improve this question
















      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







      kotlin kotlin-multiplatform






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 14:54







      jguerinet

















      asked Nov 8 '18 at 21:09









      jguerinetjguerinet

      764714




      764714
























          2 Answers
          2






          active

          oldest

          votes


















          0














          I too have this issue, in the very latest build of IntelliJ



          "IntelliJ IDEA 2018.3 EAP (Community Edition)
          Build #IC-183.4284.36, built on November 7, 2018
          JRE: 1.8.0_152-release-1343-b15 x86_64
          JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
          macOS 10.13.6"



          MPP builds fine with gradle, but won't build in the IDE. Makes it very difficult to debug.



          Has anyone found a work-around to use until the bug is fixed?






          share|improve this answer
























          • If you check out the link to the Kotlin issue within my question, you'll see that they have answered my initial question and that this is a known bug. They didn't give any estimates for when this would be fixed, but I'll update this question once they do announce a fix version.

            – jguerinet
            Nov 13 '18 at 14:52











          • re your statement that it is fixed, I have version v1.3.10-release-IJ2018.3-1, but I still get the error!

            – user2228895
            Nov 15 '18 at 19:39













          • Hm, very weird. Have you also updated to Kotlin 1.3.10 within the actual project? If you click on the issue they have a few other linked issues, some of them scheduled for 1.3.20, maybe those fixes would cover your use case?

            – jguerinet
            Nov 16 '18 at 15:32











          • As a workaround, have you tried doing this: Preferences -> Build, Execution, Deployment -> Grade -> Runner -> Check "Delegate IDE build/run actions to gradle". This will force the IDE to build using gradle, which you noted is working. That should temporarily fix your problem for debugging no?

            – jguerinet
            Nov 16 '18 at 15:34











          • thanks for the tip on 'delegate IDE actions to gradle'. It might help, but I also have another issue that jvm modules from an multiplatform build can't seem to access resources. So I am unable to see if it works. (Yes I have updated everything to 1.3.10, guess I must wait for 1.3.20)

            – user2228895
            Nov 22 '18 at 12:21





















          0














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






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53216175%2ferror-declaration-annotated-with-optionalexpectation-can-only-be-used-in-commo%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I too have this issue, in the very latest build of IntelliJ



            "IntelliJ IDEA 2018.3 EAP (Community Edition)
            Build #IC-183.4284.36, built on November 7, 2018
            JRE: 1.8.0_152-release-1343-b15 x86_64
            JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
            macOS 10.13.6"



            MPP builds fine with gradle, but won't build in the IDE. Makes it very difficult to debug.



            Has anyone found a work-around to use until the bug is fixed?






            share|improve this answer
























            • If you check out the link to the Kotlin issue within my question, you'll see that they have answered my initial question and that this is a known bug. They didn't give any estimates for when this would be fixed, but I'll update this question once they do announce a fix version.

              – jguerinet
              Nov 13 '18 at 14:52











            • re your statement that it is fixed, I have version v1.3.10-release-IJ2018.3-1, but I still get the error!

              – user2228895
              Nov 15 '18 at 19:39













            • Hm, very weird. Have you also updated to Kotlin 1.3.10 within the actual project? If you click on the issue they have a few other linked issues, some of them scheduled for 1.3.20, maybe those fixes would cover your use case?

              – jguerinet
              Nov 16 '18 at 15:32











            • As a workaround, have you tried doing this: Preferences -> Build, Execution, Deployment -> Grade -> Runner -> Check "Delegate IDE build/run actions to gradle". This will force the IDE to build using gradle, which you noted is working. That should temporarily fix your problem for debugging no?

              – jguerinet
              Nov 16 '18 at 15:34











            • thanks for the tip on 'delegate IDE actions to gradle'. It might help, but I also have another issue that jvm modules from an multiplatform build can't seem to access resources. So I am unable to see if it works. (Yes I have updated everything to 1.3.10, guess I must wait for 1.3.20)

              – user2228895
              Nov 22 '18 at 12:21


















            0














            I too have this issue, in the very latest build of IntelliJ



            "IntelliJ IDEA 2018.3 EAP (Community Edition)
            Build #IC-183.4284.36, built on November 7, 2018
            JRE: 1.8.0_152-release-1343-b15 x86_64
            JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
            macOS 10.13.6"



            MPP builds fine with gradle, but won't build in the IDE. Makes it very difficult to debug.



            Has anyone found a work-around to use until the bug is fixed?






            share|improve this answer
























            • If you check out the link to the Kotlin issue within my question, you'll see that they have answered my initial question and that this is a known bug. They didn't give any estimates for when this would be fixed, but I'll update this question once they do announce a fix version.

              – jguerinet
              Nov 13 '18 at 14:52











            • re your statement that it is fixed, I have version v1.3.10-release-IJ2018.3-1, but I still get the error!

              – user2228895
              Nov 15 '18 at 19:39













            • Hm, very weird. Have you also updated to Kotlin 1.3.10 within the actual project? If you click on the issue they have a few other linked issues, some of them scheduled for 1.3.20, maybe those fixes would cover your use case?

              – jguerinet
              Nov 16 '18 at 15:32











            • As a workaround, have you tried doing this: Preferences -> Build, Execution, Deployment -> Grade -> Runner -> Check "Delegate IDE build/run actions to gradle". This will force the IDE to build using gradle, which you noted is working. That should temporarily fix your problem for debugging no?

              – jguerinet
              Nov 16 '18 at 15:34











            • thanks for the tip on 'delegate IDE actions to gradle'. It might help, but I also have another issue that jvm modules from an multiplatform build can't seem to access resources. So I am unable to see if it works. (Yes I have updated everything to 1.3.10, guess I must wait for 1.3.20)

              – user2228895
              Nov 22 '18 at 12:21
















            0












            0








            0







            I too have this issue, in the very latest build of IntelliJ



            "IntelliJ IDEA 2018.3 EAP (Community Edition)
            Build #IC-183.4284.36, built on November 7, 2018
            JRE: 1.8.0_152-release-1343-b15 x86_64
            JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
            macOS 10.13.6"



            MPP builds fine with gradle, but won't build in the IDE. Makes it very difficult to debug.



            Has anyone found a work-around to use until the bug is fixed?






            share|improve this answer













            I too have this issue, in the very latest build of IntelliJ



            "IntelliJ IDEA 2018.3 EAP (Community Edition)
            Build #IC-183.4284.36, built on November 7, 2018
            JRE: 1.8.0_152-release-1343-b15 x86_64
            JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
            macOS 10.13.6"



            MPP builds fine with gradle, but won't build in the IDE. Makes it very difficult to debug.



            Has anyone found a work-around to use until the bug is fixed?







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 12 '18 at 8:00









            user2228895user2228895

            464




            464













            • If you check out the link to the Kotlin issue within my question, you'll see that they have answered my initial question and that this is a known bug. They didn't give any estimates for when this would be fixed, but I'll update this question once they do announce a fix version.

              – jguerinet
              Nov 13 '18 at 14:52











            • re your statement that it is fixed, I have version v1.3.10-release-IJ2018.3-1, but I still get the error!

              – user2228895
              Nov 15 '18 at 19:39













            • Hm, very weird. Have you also updated to Kotlin 1.3.10 within the actual project? If you click on the issue they have a few other linked issues, some of them scheduled for 1.3.20, maybe those fixes would cover your use case?

              – jguerinet
              Nov 16 '18 at 15:32











            • As a workaround, have you tried doing this: Preferences -> Build, Execution, Deployment -> Grade -> Runner -> Check "Delegate IDE build/run actions to gradle". This will force the IDE to build using gradle, which you noted is working. That should temporarily fix your problem for debugging no?

              – jguerinet
              Nov 16 '18 at 15:34











            • thanks for the tip on 'delegate IDE actions to gradle'. It might help, but I also have another issue that jvm modules from an multiplatform build can't seem to access resources. So I am unable to see if it works. (Yes I have updated everything to 1.3.10, guess I must wait for 1.3.20)

              – user2228895
              Nov 22 '18 at 12:21





















            • If you check out the link to the Kotlin issue within my question, you'll see that they have answered my initial question and that this is a known bug. They didn't give any estimates for when this would be fixed, but I'll update this question once they do announce a fix version.

              – jguerinet
              Nov 13 '18 at 14:52











            • re your statement that it is fixed, I have version v1.3.10-release-IJ2018.3-1, but I still get the error!

              – user2228895
              Nov 15 '18 at 19:39













            • Hm, very weird. Have you also updated to Kotlin 1.3.10 within the actual project? If you click on the issue they have a few other linked issues, some of them scheduled for 1.3.20, maybe those fixes would cover your use case?

              – jguerinet
              Nov 16 '18 at 15:32











            • As a workaround, have you tried doing this: Preferences -> Build, Execution, Deployment -> Grade -> Runner -> Check "Delegate IDE build/run actions to gradle". This will force the IDE to build using gradle, which you noted is working. That should temporarily fix your problem for debugging no?

              – jguerinet
              Nov 16 '18 at 15:34











            • thanks for the tip on 'delegate IDE actions to gradle'. It might help, but I also have another issue that jvm modules from an multiplatform build can't seem to access resources. So I am unable to see if it works. (Yes I have updated everything to 1.3.10, guess I must wait for 1.3.20)

              – user2228895
              Nov 22 '18 at 12:21



















            If you check out the link to the Kotlin issue within my question, you'll see that they have answered my initial question and that this is a known bug. They didn't give any estimates for when this would be fixed, but I'll update this question once they do announce a fix version.

            – jguerinet
            Nov 13 '18 at 14:52





            If you check out the link to the Kotlin issue within my question, you'll see that they have answered my initial question and that this is a known bug. They didn't give any estimates for when this would be fixed, but I'll update this question once they do announce a fix version.

            – jguerinet
            Nov 13 '18 at 14:52













            re your statement that it is fixed, I have version v1.3.10-release-IJ2018.3-1, but I still get the error!

            – user2228895
            Nov 15 '18 at 19:39







            re your statement that it is fixed, I have version v1.3.10-release-IJ2018.3-1, but I still get the error!

            – user2228895
            Nov 15 '18 at 19:39















            Hm, very weird. Have you also updated to Kotlin 1.3.10 within the actual project? If you click on the issue they have a few other linked issues, some of them scheduled for 1.3.20, maybe those fixes would cover your use case?

            – jguerinet
            Nov 16 '18 at 15:32





            Hm, very weird. Have you also updated to Kotlin 1.3.10 within the actual project? If you click on the issue they have a few other linked issues, some of them scheduled for 1.3.20, maybe those fixes would cover your use case?

            – jguerinet
            Nov 16 '18 at 15:32













            As a workaround, have you tried doing this: Preferences -> Build, Execution, Deployment -> Grade -> Runner -> Check "Delegate IDE build/run actions to gradle". This will force the IDE to build using gradle, which you noted is working. That should temporarily fix your problem for debugging no?

            – jguerinet
            Nov 16 '18 at 15:34





            As a workaround, have you tried doing this: Preferences -> Build, Execution, Deployment -> Grade -> Runner -> Check "Delegate IDE build/run actions to gradle". This will force the IDE to build using gradle, which you noted is working. That should temporarily fix your problem for debugging no?

            – jguerinet
            Nov 16 '18 at 15:34













            thanks for the tip on 'delegate IDE actions to gradle'. It might help, but I also have another issue that jvm modules from an multiplatform build can't seem to access resources. So I am unable to see if it works. (Yes I have updated everything to 1.3.10, guess I must wait for 1.3.20)

            – user2228895
            Nov 22 '18 at 12:21







            thanks for the tip on 'delegate IDE actions to gradle'. It might help, but I also have another issue that jvm modules from an multiplatform build can't seem to access resources. So I am unable to see if it works. (Yes I have updated everything to 1.3.10, guess I must wait for 1.3.20)

            – user2228895
            Nov 22 '18 at 12:21















            0














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






            share|improve this answer




























              0














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






              share|improve this answer


























                0












                0








                0







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






                share|improve this answer













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







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 15 '18 at 14:55









                jguerinetjguerinet

                764714




                764714






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53216175%2ferror-declaration-annotated-with-optionalexpectation-can-only-be-used-in-commo%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine