https://kotlinlang.org logo
#coroutines
Title
# coroutines
j

Jorge Recio

04/07/2020, 5:52 AM
Hi, I would like to contribute to Kotlin Coroutines. I followed all the instructions in the README. I imported the project into IntelliJ IDEA, the project does not build (as expected), I tried to delegate build actions to Gradle as explained in the Build section, but I could not find the mentioned setting. I am using:
IntelliJ IDEA 2019.3.4 (Community Edition)
Build #IC-193.6911.18, built on March 17, 2020
Runtime version: 11.0.6+8-b520.43 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.4
Can anyone help me?
e

elizarov

04/07/2020, 3:19 PM
How exactly it does not build? What's the error?
j

Jorge Recio

04/07/2020, 9:28 PM
I am using the "develop" branch and compiling the whole kotlin.coroutines project. The issues I am getting are in the "bechmarks" project:
Unresolved reference: Flow
In clases: • FlowFlattenMergeBenchmark • NumbersBenchmark • TakeBenchmark • FlowPlaysScrabbleBase • SaneFlowPlaysScrabble Even when those classes import:
Copy code
kotlinx.coroutines.flow.*
I added and import of:
Copy code
kotlinx.coroutines.flow.Flow
And the build worked from the IDE too.
Even when the build from the IDE succeeded with the Kotlin Compiler preference "Enable new type inference algorithm for IDE analysis" a compilation error is reported in SaneFlowPlaysScrabble line 34 when calling:
Copy code
Collections.reverseOrder()
e

elizarov

04/08/2020, 11:27 AM
What Java version are you using? Where JAVA_HOME points to?
j

Jorge Recio

04/09/2020, 6:40 AM
jorge$ $JAVA_HOME/bin/java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10)
OpenJDK 64-Bit Server VM (build 11.0.6+10, mixed mode)
I installed this version of the JVM and configured all required env variables (JAVA_HOME, JDK_18, JDK_16) to point to it. In the IDE I have tested using this one as the project default SDK and in the preferences I have configured Gradle to use the project SDK.
I upgraded the Kotlin plugin to version 1.3.71 before I started trying to compile the project. Could this be the cause of the issue? Is there a document explaining what is the environment that external committers should use?
e

elizarov

04/09/2020, 7:13 AM
That should all work. Very strange. Can you run
gradlew build --debug | tree build.log
and attached the resulting log here, please.
j

Jorge Recio

04/09/2020, 7:14 AM
Sure
I tried to run:
./gradlew build --debug | tree build.log
At the project root folder, but is not working.
e

elizarov

04/09/2020, 9:29 AM
What happens?
Noticed a typo
tree
->
tee
j

Jorge Recio

04/09/2020, 11:41 AM
Generated from console
e

elizarov

04/09/2020, 2:31 PM
I see
[LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] BUILD SUCCESSFUL in 58s
Does not seem like you have a problem building it anymore
j

Jorge Recio

04/09/2020, 2:53 PM
I'm sorry, I didn't explain myself correctly since the first time. From the console the project always builds correctly, from the IDE it doesn't (because Flow is not found). It would be good to have the IDE synchronized even if it is necessary to build from the console, but now it shows that Flow is not found unless I add the import.
e

elizarov

04/09/2020, 8:49 PM
What IDEA version do you use?
j

Jorge Recio

04/09/2020, 11:57 PM
I am using:
IntelliJ IDEA 2019.3.4 (Community Edition)
Build #IC-193.6911.18, built on March 17, 2020
Runtime version: 11.0.6+8-b520.43 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.4
I upgraded to the new: I am using:
IntelliJ IDEA 2019.3.4 (Community Edition)
Build #IC-193.6911.18, built on March 17, 2020
Runtime version: 11.0.6+8-b520.43 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.4
But the problem continued.
Now I realized why the issue is happening. All classes with issues are importing two packages that have a Flow implementation: • kotlinx.coroutines.flow.* • java.util.concurrent.* Even when the “benchmarks” module build.gradle specify:
Copy code
sourceCompatibility = 1.8
targetCompatibility = 1.8
...
compileJmhKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
        freeCompilerArgs += ['-Xjvm-default=enable']
    }
}
The IDE seems to be confused.
3 Views