eygraber
07/18/2024, 3:53 AMinternal
, and add that directory as a SourceSet sourceDir to both A and B.
It works fine in A, but in B the IDE complains that the code is internal
but it seems to compile fine.
I'm hoping that the way Kotlin mangles internal
code would cause there to not be redeclaration issues in consumers if they depend on both A and B, but the IDE errors are making me think twice about doing this. Should it be fine?eygraber
07/18/2024, 4:07 AMpublic
and that resolves the IDE error. It also doesn't lead to any redeclaration issues since I guess the first one encountered gets used.
So I imagine the problem here would be if there was a consumer using different versions of A and B and the behavior of the shared code changed.tapchicoma
07/18/2024, 6:59 AM-Xfriends-path
argument. Will link an issue a little latermbonnin
07/18/2024, 7:27 AMinterface foo { fun bar() }
And 2 implementations in A and B, is the IDE aware of this?mbonnin
07/18/2024, 7:28 AMtapchicoma
07/18/2024, 7:29 AMmbonnin
07/18/2024, 7:31 AMmbonnin
07/18/2024, 7:31 AMtapchicoma
07/18/2024, 7:32 AMmbonnin
07/18/2024, 7:32 AMmbonnin
07/18/2024, 7:39 AMmbonnin
07/18/2024, 7:40 AMmoduleA
and moduleB
. Both are calling srcDir("../sharecCode")
. It compiles fine but looks like the IDE can only add sharedCode
to a single module.mbonnin
07/18/2024, 7:41 AMBFoo
in the IDEmbonnin
07/18/2024, 7:41 AMsrcDir
in moduleA then the symbol is recognized again in the IDE (but moduleA fails to compile)tapchicoma
07/18/2024, 7:52 AMVampire
07/18/2024, 7:55 AMinternal
and put the shared module on the friend path when compiling A and B.
In all other cases have "internal" in the package name and tell people "don't use internal stuff".
It anyway is always just a nice try, but if someone wants to use it, there is some way.ephemient
07/18/2024, 8:05 AM@RequiresOptIn
annotation is about the same as using internal
but without needing to mess with friend pathstapchicoma
07/18/2024, 1:55 PMtapchicoma
07/18/2024, 1:59 PMmbonnin
07/18/2024, 2:35 PMmbonnin
07/18/2024, 2:36 PMshould be addressed kind-of soon.Is there a YouTrack or anything? I’m curious what can be done here. I’m tempted to say IDE support for this scenario is borderline impossible
tapchicoma
07/18/2024, 2:38 PMmbonnin
07/18/2024, 2:38 PMmbonnin
07/18/2024, 2:38 PMtapchicoma
07/18/2024, 2:39 PMmbonnin
07/18/2024, 2:39 PMThe basic idea is to allow source files to exist in several resolve contexts😮 wow
mbonnin
07/18/2024, 2:42 PM