https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
announcements
  • s

    Serge Shustov

    07/11/2021, 10:24 AM
    Hi. I'm working on a compiler plugin (DI library) that alters IR to generate a constructor injection. When some file A changed and incremental compilation kicks in I need a way to tell compiler to recompile file B as well, though before my meddling with IR there was no dependency between them. Is it even possible?
    r
    • 2
    • 1
  • a

    akuleshov7

    07/11/2021, 1:45 PM
    Hi all, I have just released a ktoml library (0.2.6) to Maven Central. It is a fully Kotlin native serialization library for TOML configuration language. It was requested by Kotlin community, but unfortunately I am developing this alone in my free time. I would like to ask for your help in testing/contributing to this project. Or at least give it a star to make it look more attractive for new contributors. Thanks! 🙏 I know that Kotlin community - is the best in the world and I appreciate your help ❤️
    👍 8
    i
    • 2
    • 1
  • a

    arthur_sav

    07/11/2021, 2:16 PM
    I’m running Ktor and log output is a bit too much. Is there any way to filter console log output in Intellij?
    n
    c
    • 3
    • 4
  • i

    Ifvwm

    07/12/2021, 3:48 AM
    abstract class Single implements View.OnClickListener {} this java code how to use kotlin express?
    s
    m
    • 3
    • 2
  • i

    Ifvwm

    07/12/2021, 11:58 AM
    class C{ 
    var l: () -> Unit = {println("hello")}; 
    fun onClick(){ l() }}
    val c = C()
    c.l = { println("world") }
    is this ok?
    b
    g
    • 3
    • 3
  • i

    Ifvwm

    07/12/2021, 12:04 PM
    by the way, why ``` can't format code any more? slack changed it?
    i
    • 2
    • 1
  • c

    Cameron Stuart

    07/12/2021, 12:48 PM
    Hi, can anyone point me in the direction of a blog that explains how to setup and work (in intellij) on a gradle kotlin group of projects that share code. Multiplatform projects, unless I'm mistaken are focused on sharing code between several platforms, but the one project. I'd like to see for example, the creation of a shared library, that can be developed on its own and consumed by multiple other projects (regardless of mono or seperate repo) without having to build and publish to a local maven or some artifact tool. The key is to be able to enhance shared code while working on other projects that consume this shared code, and have intellij aware. I have tried importing code that has gradle includeBuild syntax, but have never succeeded in getting intellij to see these included source files. My use case; I'm working on a project that has 2 backend services in micronaut and a few cli apps. And one day, a jetpack compose GUI hopefully. I'd like to share a lot of common code in data classes, SQL jdbi, and general functions. Any recommendations?
    b
    • 2
    • 2
  • a

    aaverin

    07/12/2021, 1:44 PM
    Last time I was using Jacoco for code coverage with Kotlin it was not very comfortable to use it – numbers were way off because coverage is calculated on byte-code level and it included all the getters/setters generated by Kotlin. Did situation improve since then? Anything good to measure code coverage in Kotlin projects?
    s
    a
    • 3
    • 3
  • j

    jmfayard

    07/12/2021, 3:31 PM
    Most common words in Kotlin files. Sadly android > fun
    😮 8
    l
    s
    +2
    • 5
    • 5
  • j

    Jonathan Sandusky

    07/12/2021, 6:19 PM
    Hey Gang, I was looking into
    Multiplatform Programming
    and it says it’s in
    alpha
    does the same go fo
    Kotlin for Javascript
    ? I’m looking to create a package that will build for JVM and JS to reduce duplicate business logic.
    e
    • 2
    • 1
  • m

    Michael Pohl

    07/12/2021, 6:29 PM
    So just out of curiosity I wanted to test how long a simple
    QuickSort
    implementation takes vs. Kotlin's own
    List<T>.sorted()
    . While I was on it, I also tested variations of my implementation as an extension function and without explicitly storing values in the function. And I noticed they are very different in how fast they are processed. What is causing this? See thread ->
    a
    n
    +4
    • 7
    • 25
  • c

    Charlie L

    07/12/2021, 11:33 PM
    Is
    listOf(…).map { async { someNio() } }.awaitAll()
    discouraged for any reason? I came across the “worker pool” pattern.
    l
    • 2
    • 1
  • e

    eirikb

    07/13/2021, 5:25 AM
    Hi. I'm using delegates outside of fields. This produces a warning
    ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
    upon assignment only. While that warning is technically correct, and makes sense, it would be nice to remove it. How? My code looks like this:
    var ok by okProp
    ok = true
    where setting
    ok
    will have side effect. Example: https://pl.kotl.in/81eXfsXLG (press run to get the warnings). On a side note, the decompiled code looks like this:
    KProperty var1 = $$delegatedProperties[0];
    ReadWriteProperty ok = okProp;
    ok.setValue((Object)null, var1, true);
    As one would expect the variable will be both accessed and assigned, just not in Kotlin
    d
    e
    • 3
    • 10
  • p

    Piyush Kukadiya

    07/13/2021, 12:52 PM
    How Can I add CSS to developer documentation? We can use html in multi-line comments like below, but i would also like to use external css for html used inside multi-line comments. How can I achieve this? Thanks
    Untitled
    b
    h
    • 3
    • 13
  • w

    wasyl

    07/13/2021, 1:17 PM
    Is https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md going to be updated? Looking for recent releases is a pain if you don’t know the exact tag (https://github.com/JetBrains/kotlin/releases is flooded with dev releases) and it’s nice to have a one link to refer to for changes
    b
    d
    • 3
    • 4
  • z

    Zimri Leisher

    07/13/2021, 6:35 PM
    i've been forced to write in python for the last couple weeks, and i keep on having to use some strange combination of iteration functions to to, for example, get the first element matching a predicate, or to iterated with a window through a list. every time, i wish i could just use kotlin 😢
    j
    s
    • 3
    • 3
  • a

    althaf

    07/14/2021, 6:26 AM
    hi i have a strange behavior from Kotlin both IntellJ Community Edition and Android Studio is using Kotlin 1.5 ,
    var paymentMethod: String? = null
    var result = paymentMethod?.takeIf { !it.isNullOrBlank() } ?: let { "-" }
    println("output " + result)
    The let part is working fine is android studio . However it is showing error in Community Edition. Is this expected or some strange behavior ?
    r
    t
    • 3
    • 9
  • d

    dawidhyzy

    07/14/2021, 7:05 AM
    I have strange behaviour when accessing value class properties from java. Any idea why?
    c
    • 2
    • 5
  • a

    Alina Dolgikh [JB]

    07/14/2021, 1:20 PM
    📣📣📣 Hi everyone <!here>! This is just a friendly reminder that you have until July 20 to share your feedback about our Slack Community updates and apply to be a moderator. https://kotlinlang.slack.com/archives/C0922A726/p1625206471145200
    👍🏽 1
    👍 13
    👍🏼 1
    a
    • 2
    • 1
  • r

    Roar Gronmo

    07/14/2021, 1:22 PM
    I am probably too sensitive to be a moderator...
    r
    a
    • 3
    • 2
  • t

    Tamarind

    07/14/2021, 5:50 PM
    Hello. I am working through the Kotlin Koans and currently at https://play.kotlinlang.org/koans/Collections/Fold/Task.kt. Am I understanding the problem correctly in that Shop.getProductsOrderedByAll() should return a set of products that were purchased by all of the customers? Therefore, if there is at least one customer who did not purchase a product, then that product should not be part of the resulting set?
    d
    m
    • 3
    • 6
  • a

    Austin Paquette

    07/14/2021, 7:38 PM
    Hey all, I'm not really understanding how to harness the full power of trailing lambdas, I'm fairly certain it's what I want but I'm also open to being wrong. I am fairly Inexperienced with Kotlin so please take me to school if you need to! I am trying to mimic behaviour that I noticed in Ktor's HTTP Client when it comes to applying the
    body
    parameter, but in my own abstraction of a client for a particular service endpoint. Basically, I have this function (fluff removed), but point is clear.
    sendNotification(listOf("..."), listOf("..."))
    This is ultimately fine and works as intended, but I am trying to find a way to explicitly set each of these values. Instead I'd like to do this:
    sendNotification() {
        subscriberKeys = listOf("...")
        users = listOf("...")
    }
    This helps me describe exactly what I need each value to be and then pass them through the implementation, I just don't fundamentally understand the examples provided. I've tried with some smaller sample code but nothing quite clicks yet. I'll gladly accept links to helpful resources too, I've done a fair amount of searching but nothing has quite illuminated the lightbulb on this.
    s
    n
    • 3
    • 5
  • a

    althaf

    07/15/2021, 6:55 AM
    Hey all, is possible to simplify this code either using when or some other idiomatic way in kotlin,
    private fun hideDeliveryDetailsIfNotRequired() {
        if (clearingZone.title == "-" && deliverMethod.title == "-"
            && deliverTo.title == "-" && pickupLocation.title == "-"
        ) {
            clearingZone.visibility = View.GONE
            deliverMethod.visibility = View.GONE
            deliverTo.visibility = View.GONE
            pickupLocation.visibility = View.GONE
        }
    }
    d
    y
    • 3
    • 3
  • m

    Matt

    07/15/2021, 12:55 PM
    Does anyone have an example of using a ConfigurableJacksonXml? How do I get http4k to use my mapper rather than the default?
    • 1
    • 1
  • u

    user

    07/15/2021, 2:23 PM
    Multiplatform Gradle Plugin Improved for Connecting KMM Modules If you use Kotlin Multiplatform Mobile (KMM) for sharing code between iOS and Android, you will at some point have to decide how you will deliver the shared module to your platform projects. While Android integration is smooth out of the box, iOS integration can require some additional setup. In this post, you will learn […]
    :kotlin-intensifies: 1
    t
    • 1
    • 1
  • a

    Anamika Trivedi

    07/15/2021, 2:48 PM
    Is there any channel specifically for KMM questions?
    m
    • 2
    • 2
  • n

    nilTheDev

    07/15/2021, 3:50 PM
    What would be the difference between the following code snippets?
    class Dummy{
        private val _data = mutableListOf<Int>()
        val data:ListOf<Int> = _data
    }
    class Dummy{
        private val _data = mutableListOf<Int>()
        val data: ListOf<Int>
            get() = _data
    Thanks for your help.
    t
    n
    • 3
    • 5
  • j

    Jgafner

    07/15/2021, 7:08 PM
    Hi Is there a way to intersect an unknown number of list ?
    n
    • 2
    • 2
  • a

    Alex S

    07/15/2021, 11:36 PM
    hello! 👋 Has anyone seen this issue on CI?
    [kapt] 'com.sun.tools.javac.util.Context' class can't be found ('tools.jar' is absent in the plugin classpath). Kapt won't work.
    v
    • 2
    • 2
  • d

    Dra

    07/16/2021, 5:15 AM
    Hey everyone ! After having used Kotlin for some time, I encountered usage of Reactor, Coroutines and a bit of Reactive with RxJava (Didn't knew that there was a RxKotlin at this time) but two main questions came to my mind... When should I use one over an other ? Would it be bad practice to use multiple of them in the same project ?
    e
    s
    • 3
    • 2
Powered by Linen
Title
d

Dra

07/16/2021, 5:15 AM
Hey everyone ! After having used Kotlin for some time, I encountered usage of Reactor, Coroutines and a bit of Reactive with RxJava (Didn't knew that there was a RxKotlin at this time) but two main questions came to my mind... When should I use one over an other ? Would it be bad practice to use multiple of them in the same project ?
e

eirikb

07/16/2021, 5:25 AM
What makes them different from coroutine flow?
s

Sourabh Rawat

07/16/2021, 7:50 AM
Use Reactor if you need to interact with Java code as well. Otherwise, for kotlin only projects, coroutines are always preferred.
👍 1
View count: 1