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
getting-started
  • s

    Simon Nozaki

    06/14/2022, 8:42 AM
    Hi, I’m a fan of Kotlin(especially JVM), so I would like to contribute Koltin/stdlib/ktor and so on. How can I search easily
    good-first-issue
    on YouTrack or other way? It seems that Kotlin YouTrack has no issues or tags of it. Thanks.
    e
    • 2
    • 2
  • p

    Phani Mahesh

    06/14/2022, 12:49 PM
    I have a strange problem. I need to recursively call a reified inline function, which is disallowed by the compiler. any workarounds? to avoid XY problem, here’s what my actual goal is: I am writing a custom transformer on data classes that does something based on annotated fields, and I want to be able to use these data classes themselves as fields.
    m
    • 2
    • 1
  • c

    cheeze2000

    06/14/2022, 12:53 PM
    https://kotlinlang.org/docs/native-gradle.html hello i'm trying kotlin native with gradle and this code seems to work smoothly until i add a package name in the
    hello.kt
    file and then the error
    Could not find 'main' in '<root>' package.
    happens. does anyone know how i can update the gradle file so it builds successfully again?
    e
    • 2
    • 2
  • c

    cheeze2000

    06/14/2022, 11:55 PM
    hello, i have another question on kotlin native and gradle. this is my current
    build.gradle.kts
    kotlin {
        linuxX64("native") {
            binaries {
                executable()
            }
        }
    
        mingwX64("native") {
            binaries {
                executable()
            }
        }
    }
    is this the correct way to define multiple targets? if so, how do i run gradle to compile for both platforms? there is an error when i run
    gradle nativeBinaries
    : The target 'native' already exists, but it was not created with the 'mingwX64' preset. To configure it, access it by name in
    kotlin.targets
    or use the preset function 'linuxX64'.
    v
    e
    • 3
    • 7
  • e

    elect

    06/15/2022, 10:57 AM
    is there a trick to overcome clashing function signatures with different returns values?
    fun TfFile.cert_request(configure: CertRequest.() -> Unit): CertRequest
    
    fun TfFile.cert_request(configure: CertRequest.() -> Unit): PropertyDelegateProvider<Any?, ReadOnlyProperty<Any?, CertRequest>>
    @JvmName
    works only for case like
    List<String
    and
    List<Int
    and
    @OverloadResolutionByLambdaReturnType
    only with lambdas returning different values
    j
    y
    • 3
    • 25
  • s

    Starr

    06/15/2022, 11:00 AM
    I mean, give the function different names?
    ➕ 1
    e
    • 2
    • 3
  • d

    deviant

    06/15/2022, 12:23 PM
    does anybody know why we need this verbosity?
    e
    a
    • 3
    • 6
  • n

    Norbi

    06/15/2022, 8:24 PM
    Hello, I try to use ki-shell but no matter what I do, when I execute my code I get the following error:
    ki-shell 0.4.6-SNAPSHOT/1.6.21
    type :h for help
    [0] :dependsOn <my library here>
    [1] some.package.test()
    ERROR Class 'some.package.TestKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler (Line_2.kts:1:15)
    I even tried to compile a custom version of ki-shell with Kotlin 1.6.21 but nothing changed. My project is also compiled using Kotlin 1.6.21. May I ask what triggers the "pre-release" property of a compiled class? Thanks.
    e
    • 2
    • 2
  • d

    Dieter Konrad

    06/16/2022, 1:24 PM
    Hey I need for a coding challenge an IDE with Kotlin 1.3 support. How I get this IntelliJ Version?
    s
    • 2
    • 7
  • s

    Sid Med

    06/16/2022, 11:06 PM
    Don’t know if this is the right channel to ask (apologies if not the case). Jackson annotation on an interface (to tell Jackson what implementation class to use during deserialization) cannot be used because the word “as” is a keyword in Kotlin and Jackson is using that keyword to specify the implementation class:
    y
    • 2
    • 2
  • s

    Sid Med

    06/16/2022, 11:06 PM
    @*JsonDeserialize*(as = MyInterfaceImpl.class)
    :thread-please: 3
  • s

    Sid Med

    06/16/2022, 11:06 PM
    Is there a way to to solve this issue?
    :thread-please: 3
  • z

    zain

    06/17/2022, 7:54 AM
    I have this data I want to get all employees with permanent addresses, I want to even get one address for each employee 🤔
    val employees =
        listOf<Employee>(
            Employee(
                id = 1,
                listOf(
                    Address(id = 1, isPerm = false),
                    Address(id = 2, isPerm = true),
                    Address(id = 3, isPerm = true)
                )
            ),
            Employee(
                id = 2,
                listOf(
                    Address(id = 1, isPerm = false),
                    Address(id = 2, isPerm = false),
                    Address(id = 3, isPerm = true)
                )
            )
        )
    m
    k
    y
    • 4
    • 7
  • s

    server

    06/17/2022, 1:20 PM
    I'm using spock for testing(it won't be changed) is it possible to make kotlin use@JvmStatic by default for generated methods? I know there are spring plugins that make classes not final by default. is there something like this for static methods?
    y
    • 2
    • 8
  • v

    Vampire

    06/17/2022, 3:24 PM
    Can override an extension function somehow? I guess not. 😕
    :nice: 1
    j
    e
    • 3
    • 15
  • l

    Lawrence

    06/18/2022, 2:48 PM
    does anyone have any experience with SQLDelight and/ jOOQ? I am building a UI for our java tool with Jetpack Compose. Looks like SQLDelight is pretty great but I think my Java devs would be more comfortable around jOOQ. Thoughts?
  • m

    moltendorf

    06/18/2022, 9:41 PM
    Hi there, looking to update an old react (kotlin) app I started on and I'm stuck on
    useLocation() may be used only in the context of a <Router> component
    no matter which block I put it in?
    val App = FC<Props> {
      BrowserRouter {
        Routes {
          Route {
            useLocation() // ...
    k
    l
    • 3
    • 4
  • c

    cheeze2000

    06/19/2022, 9:51 AM
    hello, i want to ask about kotlin jvm. after you compile it to java bytecode, is it possible to bundle it in such a way that computers without java can run it?
    t
    e
    • 3
    • 4
  • y

    Youssef Shoaib [MOD]

    06/19/2022, 2:22 PM
    Is there a better way to build a map from 2 lists such that it's based on their order in the list? Currently, I'm doing
    list1.zip(list2).toMap()
    but it turns them into pairs in the process and I don't quite like that. Is there a neater 1-liner for it? I looked at associateWtih and associateBy but I can't seem to get them to work for this use case. Edit: Neatest one-liner I've found:
    (0..list1.lastIndex).associateBy(list1::get, list2::get)
    c
    e
    • 3
    • 12
  • h

    Hassaan

    06/19/2022, 7:15 PM
    Can i use top level property/variable inside a class as top level functions
    y
    • 2
    • 4
  • a

    andylamax

    06/19/2022, 10:48 PM
    Is there a way to circumvent overload resolution ambiguity on the following two functions without giving the functions different names,
    class Zipped<out T>(val value:T)
    
    // function one
    fun <T,R> Zipped<T>.map(mapper: (T)->R): Zipped<R> {
      // . . .
    }
    
    // function two
    fun <T,R> Zipped<Zipped<T>>.map(mapper: (T)->R) : Zipped<R> {
      // . . .
    }
    
    fun main() {
      val zipped: Zipped<Zipped<Int>> = Zipped(Zipped(2))
      val result = zipped.map { "zipped value: $it" } // when calling this function?
    }
    v
    e
    +2
    • 5
    • 11
  • j

    jeggy

    06/20/2022, 8:00 AM
    Is this considered a bug or am I really required to specify that it's an
    Int
    and not a
    Long
    ?
    v
    t
    a
    • 4
    • 6
  • v

    Vitali Plagov

    06/20/2022, 7:22 PM
    Hi. I'm probably missing some basic essential stuff, if so could someone please point me into a correct direction? I have a string
    "aaa\"aaa"
    . When I evaluate an expression while in debug and check the length of the string, then it shows it is 8. But checking the same in the scratch file - it shows length equal to 7. Why is it so? What am I missing?
    c
    k
    • 3
    • 2
  • m

    Michael de Kaste

    06/21/2022, 1:15 PM
    why isn't this implicitly forced?
    e
    • 2
    • 7
  • p

    Phani Mahesh

    06/21/2022, 3:23 PM
    I’m using kotlin-faker to generate random instances for something similar to fuzz testing with json. I want to avoid empty lists and null values in the generated object, and am unable to wrangle it right. any tips?
  • n

    Nga Pham

    06/21/2022, 3:23 PM
    I am tasked with convincing my team to adopt Kotlin. What are key features of Kotlin and its long term trend? Thanks
    p
    j
    +2
    • 5
    • 13
  • c

    cheeze2000

    06/21/2022, 4:40 PM
    i have two gradle tasks,
    ./gradlew build
    and
    ./gradlew run
    . is it possible to specify
    --console=plain
    inside the
    build.gradle.kts
    file on one of them so i don't have to keep typing the flag?
    k
    • 2
    • 2
  • w

    Wolfgang

    06/21/2022, 4:57 PM
    Please anyone recommend a good course on SOLID principles for Kotlin
  • m

    Matthew Murray

    06/21/2022, 6:57 PM
    Are the docs missing a section about enums in Objective-C/Swift? https://kotlinlang.org/docs/native-objc-interop.html
  • m

    Matthew Murray

    06/21/2022, 6:58 PM
    Couldn’t find anything about how to use a
    switch
    statement from Kotlin/Native in Obj-C, since it converts Kotlin enums to a class, not an actual enum.
Powered by Linen
Title
m

Matthew Murray

06/21/2022, 6:58 PM
Couldn’t find anything about how to use a
switch
statement from Kotlin/Native in Obj-C, since it converts Kotlin enums to a class, not an actual enum.
View count: 4