https://kotlinlang.org logo
Join Slack
Powered by
# jvm
  • i

    ianbrandt

    10/15/2024, 4:56 PM
    set the channel description: This channel is for discussion of topics specific to the Kotlin/JVM platform. https://kotlinlang.org/docs/jvm-get-started.html
  • i

    ianbrandt

    10/15/2024, 5:02 PM
    Welcome All, Let's discuss Kotlin/JVM-specific topics here. For discussion related to the other platforms Kotlin targets, see #C3PQML5NU, #C3SGXARS6, #C0B8L3U69, and #CDFP59223 respectively.
  • i

    ianbrandt

    10/15/2024, 5:19 PM
    set the channel description: This channel is for discussion of topics specific to the Kotlin/JVM platform. https://kotlinlang.org/docs/jvm-get-started.html
  • i

    ianbrandt

    10/15/2024, 5:24 PM
    set the channel topic: The Kotlin/JVM platform. https://kotlinlang.org/docs/jvm-get-started.html
  • i

    ianbrandt

    10/18/2024, 8:19 PM
    One Kotlin/JVM-specific issue that impacts my team, we've long wanted to migrate our mixed Java/Kotlin server and desktop application to the Java Platform Module System (JPMS, Project Jigsaw, JSR 376, JEP 261). JPMS has been part of the JVM platform since JDK 9, released in 2017. We find with Kotlin's module-centric `internal`, and lack of package-private (KT-29227), we tend to make more fine-grained modules than we might otherwise. JPMS would help with maintaining encapsulation, in particular given the default restriction on reflection for modules loaded as such, and also via qualified exports. JPMS is also a requirement for use of JavaFX. We've been tracking blocking bugs in Gradle, Kotlin, and IntelliJ for some time. Many have been fixed, but three (that we know of) required for incremental migration are still outstanding. I wanted to raise awareness of them (vote early and often 😉), and appeal to JetBrains to put better Kotlin/JVM support for JPMS on the roadmap. • https://youtrack.jetbrains.com/issue/KT-20740/Support-Xadd-exports-Xadd-reads-Xpatch-module-similar-to-javacs-add-exports-add-reads-patch-module • https://youtrack.jetbrains.com/issue/KTIJ-27483/Run-configurations-are-not-picking-app-configuration-from-build.gradle.kts-as-described-in-docs • https://youtrack.jetbrains.com/issue/IDEA-154038/IDEA-doesnt-respect-Gradle-compiler-settings I've added further details and reproducers to each. The last one is admittedly not kotlin but kotlin colored, but I don't believe fixes for the other two would be usable in practice without it. Is anyone else trying to use JPMS with Kotlin? Have you had much luck?
    • 1
    • 7
  • j

    JP Sugarbroad

    12/03/2024, 10:09 PM
    So I have a Java library that has many builders that take
    Consumer<? super ThingBuilder>
    and when I try to use them from Kotlin the
    ThingBuilder
    is an argument instead of a receiver. Is there any annotation I can use to mark that this should be a receiver, or am I stuck wrapping everything?
    j
    v
    • 3
    • 10
  • j

    JP Sugarbroad

    02/24/2025, 12:31 AM
    It looks like KT-16650 has regressed in K2. The signature is now
    implements KeySelector
    with no type arguments at all. I can't find a bug tracking this, does anyone know of one before I open a new one?
    • 1
    • 1
  • l

    Lee Hayeon

    06/11/2025, 9:02 AM
    I've recently come across a pattern in JetBrains Amper where you don't specify a package and instead place the main files directly in the root of the `src` directory. Has anyone used this approach, and does it scale well for larger projects?
  • z

    zt

    06/21/2025, 6:28 AM
    I've been working on my ffmpeg wrapper and making good progress, however it's kinda been a pain having to make everything with a closeable method. I had an idea to get around this inconvenience by copying the native objects properties to a Kotlin data class, and then freeing the native object right there. Since ffmpeg packets are just data and some extra info, this should work. I'm not sure how big packets get, possibly up to a megabyte of data. So does anyone know how efficient would Kotlin/JVM be with copying data like this at several packets per second, or if the overhead would be too much. Or is there an another way to eliminate needing to manually free these packets?
    l
    • 2
    • 1
  • i

    Ian Botsford

    07/02/2025, 9:25 PM
    I don't fully understand Kotlin 2.2.0's changes to default method generation for interface functions. I see that there are now 3 options but it's not clear to me why someone would choose
    enable
    vs
    no-compatibility
    vs
    disable
    . The documentation gives little blurbs but the implications are not clear:
    •
    enable
    (default): generates default implementations in interfaces and includes bridge functions in subclasses and
    DefaultImpls
    classes. Use this mode to maintain binary compatibility with older Kotlin versions.
    Maintain compatibility how? My K-2.2 lib can call a K-2.1 lib? A K-2.1 lib can call my K-2.2 lib? Something else? Can I imply that neither of the other options maintain binary compat with older Kotlin versions? (seems like
    disable
    might)
    • `no-compatibility`: generates only default implementations in interfaces. This mode skips compatibility bridges and
    DefaultImpls
    classes, making it suitable for new code.
    What're the implications of skipping compatibility bridges and
    DefaultImpls
    classes? Why are those good/bad things?
    • `disable`: disables default implementations in interfaces. Only bridge functions and
    DefaultImpls
    classes are generated, matching the behavior before Kotlin 2.2.0.
    What're the implications of disabling default implementations in interfaces? Why are those good/bad things?
    u
    • 2
    • 2