https://kotlinlang.org
Join Slack
What's the best way to customise jvmargs of the kotlin daemon? <Docs recommend> using `kotlin.daemon...
v

vibin

about 2 years ago
What's the best way to customise jvmargs of the kotlin daemon? Docs recommend using
kotlin.daemon.jvmargs
property in gradle.properties, but how do I use this from command line? For ex. with,
./gradlew bundleDebug -Dorg.gradle.jvmargs="-Duser.language=en -Xmx5g" -Dkotlin.daemon.jvmargs="-Duser.language=fr -Xmx4g"
I see that the Xmx argument that I provided for Kotlin daemon is ignored and instead it's taken from Gradle daemon's jvmargs
$ jcmd 26327 VM.command_line
26327:
VM Arguments:
jvm_args: <redacted> -Xmx5g -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant
java_command: org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.3.3

$ jcmd 26433 VM.command_line
26433:
VM Arguments:
jvm_args: -Xmx5g -Djava.awt.headless=true -D$java.rmi.server.hostname=127.0.0.1 -Dkotlin.environment.keepalive -ea
java_command: org.jetbrains.kotlin.daemon.KotlinCompileDaemon <redacted>
v
t
  • 2
  • 4
  • 664
Is there a way to split a list in two at a given index? I tried `partition` but I can't give it a t...
c

Colton Idle

over 2 years ago
Is there a way to split a list in two at a given index? I tried
partition
but I can't give it a true/false predicate. I just want to give it a location. I tried
slice
but it only gives me a list after the index. I just wanna be able to slice a list into two parts at a given index and get both parts in one shot (that should be more performant than calling slice twice... right?)
c
y
+6
  • 8
  • 22
  • 664
I'm getting `e: Could not find 'main' in '&lt;root&gt;' package.` when trying to build either of the...
z

zt

about 3 years ago
I'm getting
e: Could not find 'main' in '<root>' package.
when trying to build either of the modules in my project. I've set up the gradle config like this
linuxX64("native") {
    binaries {
        executable("prism")
    }
}
z
l
a
  • 3
  • 14
  • 664
How do I send/receive HTTP/2 streams using ktor?
t

Tianyu Zhu

over 2 years ago
How do I send/receive HTTP/2 streams using ktor?
👀 1
t
s
  • 2
  • 3
  • 663
Trying to serialize generic data class having with default value produces empty JSON object `{}` Ea...
d

Danish Ansari

about 4 years ago
Trying to serialize generic data class having with default value produces empty JSON object
{}
Easiest way to reproduce this issue is to try official generic classes example, add
data
modifier to the class and have default value (eg. in thread) https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/basic-serialization.md#generic-classes I'm using kotlinx.serialization v1.2.2 and Kotlin v1.5.21 Update: All I had to do was read this section of doc 😅https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/json.md#encoding-defaults
d
e
  • 2
  • 2
  • 663
Trying use paging 3 lib with filter I cannot explain why it crashed if I don’t insert in between .ca...
c

Ciprian Grigor

over 4 years ago
Trying use paging 3 lib with filter I cannot explain why it crashed if I don’t insert in between .cachedIn(viewModelScope)
val repoResult: Flow<PagingData<Repo>> = queryFlow.filterNotNull()
        .flatMapLatest { query ->
            repository.getSearchResultStream(query)
        }
        //.cachedIn(viewModelScope) //crash without
        .combine(filterFlow) { page, filter ->
            page.filter {
                it.description?.contains(filter, true) ?: false
            }
        }

    lifecycleScope.launch {
            viewModel.repoResult.collectLatest {
                adapter.submitData(it)
            }
    }

crash is java.lang.IllegalStateException: Attempt to collect twice from pageEventFlow, which is an illegal operation. Did you forget to call Flow<PagingData<*>>.cachedIn(coroutineScope)?
c
i
  • 2
  • 2
  • 663
Hello! I tried to mockk a kotlin `flow` so I can bypass one line of code in my class. Basically I ne...
m

Mikolaj

over 2 years ago
Hello! I tried to mockk a kotlin
flow
so I can bypass one line of code in my class. Basically I need to bypass the
dropWhile
method so it passes the values in flow to the next method. I tried to create mock like that:
@Test
    fun `test mock flow`() = runTest {
        val flow: Flow<Int> = mockk(relaxed = true) {
            coEvery { dropWhile(any()) } returns this
        }
    }
But then i get error
Failed matching mocking signature for left matchers: [any()]
. Is it possible to create a mock that will bypass the
dropWhile
method? Thanks!
m
j
  • 2
  • 6
  • 662
Is there a `@IntRange` annotation for kotlin which I can use in kotlin only module? @IntRange works ...
l

Lilly

over 3 years ago
Is there a
@IntRange
annotation for kotlin which I can use in kotlin only module? @IntRange works at compilation time right?
l
e
c
  • 3
  • 8
  • 662
I got this crash in my crashlytics today and it doesn’t have the triggering point (where it trigger...
t

theapache64

over 3 years ago
I got this crash in my crashlytics today and it doesn’t have the triggering point (where it triggered from).
Fatal Exception: java.lang.IllegalArgumentException
Cannot round NaN value.
kotlin.math.MathKt__MathJVMKt.roundToInt (MathKt__MathJVMKt.java:1132)
androidx.compose.animation.core.VectorConvertersKt$IntOffsetToVector$2.invoke-Bjo55l4 (VectorConverters.kt:172)
It looks like its thrown from the animation framework . Full stacktrace in 🧵
t
t
d
  • 3
  • 6
  • 662
Does anyone know if there is any datepicker for compose desktop? thanks in advance!
m

Mario Javier Medina Cocom

over 3 years ago
Does anyone know if there is any datepicker for compose desktop? thanks in advance!
m
m
  • 2
  • 2
  • 662
Previous899091Next

kotlinlang

A modern programming language that makes developers happier.

Powered by