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

napperley

11/06/2018, 9:07 PM
Seeing a strange TypeError appear in the Browser console that seems to be coming from the KotlinX Coroutines Core JS library:
Copy code
kotlinx-coroutines-core.js:19616 TypeError: Cannot read property 'iterator' of undefined
    at addAll (MutableCollections.kt:127)
    at GroupStatistics.mainLanguage_e0v785$ (_Arrays.kt:8034)
    at updateStatsLayout (main.kt:93)
    at Coroutine$processFetchedRepos$lambda.doResume (main.kt:85)
    at Coroutine$processFetchedRepos$lambda.CoroutineImpl.resumeWith_tl1gpc$ (CoroutineImpl.kt:47)
    at CancellableContinuationImpl.DispatchedTask.run (kotlinx-coroutines-core.js:2682)
    at WindowDispatcher$queue$ObjectLiteral.MessageQueue.process (kotlinx-coroutines-core.js:19877)
    at kotlinx-coroutines-core.js:19846
v

Vsevolod Tolstopyatov [JB]

11/06/2018, 9:12 PM
it could be a bug in the JS compiler, could you please make small self-contained example?
n

napperley

11/06/2018, 9:36 PM
Not a trivial project, but it contains everything that is needed to reproduce the bug: https://gitlab.com/napperley/repo-stats
Will also need to include the prerequisite libraries from here: https://gitlab.com/webscene/webscene-core The libraries are created by running the following:
./gradlew publish
. After doing that some local Maven repos are created which are found in common/build/repository/org and js/build/repository/org. Copy the repos into
repos-stats/web-client/libs
. Do a Gradle refresh on repo-stats.
r

Roman Artemev [JB]

11/12/2018, 1:29 PM
The problem is about wrong JSON parser, you are using
kotlin.js.JSON
expecting
kotlinx.serialization.json.JSON
. The proper fix would be like
Copy code
import kotlinx.serialization.json.JSON
// ...
val repos = JSON.parse(Repo.serializer().list, jsonStr)
👍 1
2 Views