https://kotlinlang.org logo
Docs
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

    Sylvain Patenaude

    12/03/2019, 10:24 PM
    Anyone seeing a problem with this extension function?
    package toto.toto2
    
    @ExperimentalUnsignedTypes
    fun UByteArray.toUnsignedInt(): UInt {
        return ...
    }
    When I try to call it from inside an
    object
    , like this:
    myUInt = myUByteArray.toUnsignedInt()
    , I have an Unresolved reference. Thanks in advance!
    a
    2 replies · 2 participants
  • g

    Gyuhyeon

    12/04/2019, 6:45 AM
    So.. when we declare a getter for a field in Kotlin, there's no way to just directly call the field privately?
    class MembershipInfo {
        var birthday: String? = null
            get() = if (field.isNullOrBlank() && birthdayEnc.isNotNullOrBlank()) {
                field = birthdayEnc.let {
                    AesEncryptor.decryptText(it)
                }
                field
            } else {
                field
            }
        var birthdayEnc: String? = null
            get() = if (field.isNullOrBlank() && birthday.isNotNullOrBlank()) {
                field = birthday.let {
                    AesEncryptor.encryptText(it)
                }
                field
            } else {
                field
            }
    }
    this code is giving me a wonderful stack overflow error when both fields are set as null. apparently, calling birthdayEnc.isNotNullOrBlank() calls birthdayEnc's getter instead of accessing it directly. This is calling from WITHIN the class, this seems like a design oversight ._. any workarounds?
    k
    2 replies · 2 participants
  • m

    michmanharitonov1

    12/04/2019, 7:43 AM
    Is there a kotlin conf channel?
    k
    d
    3 replies · 3 participants
  • s

    spand

    12/04/2019, 8:25 AM
    Is there a particular reason objects cannot be autocast in this case:
    sealed class Sc {
        object Foo : Sc()
    }
    
    fun (sc: Sc){
        when (sc){
            Sc.Foo -> sc // <-- type is still Sc here, not Foo
        }
    }
    Seems like a basic case but I couldnt even find an issue on youtrack about it
    j
    d
    +2
    8 replies · 5 participants
  • j

    jimn

    12/04/2019, 9:27 AM
    maybe a curry example exists somewhere?
    k
    2 replies · 2 participants
  • j

    Jukka Siivonen

    12/04/2019, 9:45 AM
    Hello, when using IDEA and selecting "Run/Debug" for single Test function (Junit5) I get option to only run whole test class and not the particular function, this seems to be an issue only with Kotlin. Is this known problem?
    j
    k
    +1
    5 replies · 4 participants
  • a

    Ashutosh Panda

    12/04/2019, 10:01 AM
    I want to create an array in which would contain objects of an class and with size 10 but first I want to declare it globally without any entries in array and later on use a function to entry it. Is it possible in kotlin and what is the syntax
    g
    j
    +1
    13 replies · 4 participants
  • a

    Ashutosh Panda

    12/04/2019, 10:13 AM
    The above prog is showing an error
    d
    3 replies · 2 participants
  • j

    jimn

    12/04/2019, 10:13 AM
    must use arrayOfNulls<customer?>
    d
    a
    7 replies · 3 participants
  • c

    Chris Miller

    12/04/2019, 10:28 AM
    I'm assuming based on the "Future improvements" section on this KEEP https://github.com/Kotlin/KEEP/blob/master/proposals/data-class-inheritance.md that the following isn't possible? Any suggestions for the most elegant alternative?
    sealed class TimedEvent(val eventTime: Long)
    data class FxRateEvent(val currency: String, val rate: Double, eventTime: Long) : TimedEvent(eventTime)
    a
    7 replies · 2 participants
  • x

    Xavier F. Gouchet

    12/04/2019, 11:00 AM
    Hey folks, I know that Kotlin doesn't support checked exception in the language. But when calling a java method from a library, is there a way to at least get a warning in the IDE for java methods throwing checked java exceptions?
    👍 1
    s
    s
    6 replies · 3 participants
  • p

    Pacane

    12/04/2019, 3:12 PM
    Why does IntelliJ's Java to Kotlin converter convert this
    class A<T> {}
    to
    class <A?> {}
    in Kotlin ?
    d
    w
    +3
    37 replies · 6 participants
  • h

    Hullaballoonatic

    12/04/2019, 5:11 PM
    where in the language might you ever see curly braces sequentially like this:
    { ... } { ... }
    I'm musing on the reason why you can't place multiple lambda arguments outside the function parameter parentheses:
    myPairs.associateBy { (k, _) -> k } { (_, v) -> v } // does not compile
    myPairs.associateBy({ (k, _) -> k }, { (_, v) -> v }) // compiles
    nbd. just thinking of course maybe it just doesn't read well, since parameters are separated by a comma, and sequential lambda arguments outside the parentheses would not.
    m
    e
    +2
    16 replies · 5 participants
  • s

    steenooo

    12/04/2019, 5:47 PM
    is it possible to do this more elegant? Let these perhaps be generated, instead of having to write them all out
    s
    b
    +1
    6 replies · 4 participants
  • a

    Adam Spofford

    12/04/2019, 10:04 PM
    I can't use
    sequence { }
    with abstract suspending functions, because
    StreamingCmd
    has to inherit from
    CmdBase
    and so can't inherit from
    SequenceScope
    d
    2 replies · 2 participants
  • m

    Mani

    12/05/2019, 8:40 AM
    how do we pretty print a
    mutableMap<String, String>
    ? .toString() works?
    k
    1 reply · 2 participants
  • g

    gotoOla

    12/05/2019, 10:22 AM
    Does anyone know if there exists an "official" editorconfig for kotlin?
    s
    4 replies · 2 participants
  • a

    asad.awadia

    12/05/2019, 10:31 AM
    Is the live stream up for kotlin conf?
    l
    s
    +1
    3 replies · 4 participants
  • w

    wasyl

    12/05/2019, 11:19 AM
    Is using function references in any way different than wrapping calls in lambdas? For example with
    fun doSomething(param: String)
    fun foo(param: String) 
    
    foo { doSomething(it) }
    vs
    foo(::doSomething)
    vs
    foo(instance::doSomething)
    is bytecode for either option more efficient for example?
    j
    r
    7 replies · 3 participants
  • a

    Ashutosh Panda

    12/05/2019, 12:40 PM
    the error is function should have return statement
    d
    s
    17 replies · 3 participants
  • l

    Leon K

    12/05/2019, 4:11 PM
    is it possible to throw custom exceptions using
    require
    and
    requireNotNull
    ? currently afaik it always throws an
    IllegalArgumentException
    s
    z
    2 replies · 3 participants
  • s

    steenooo

    12/05/2019, 4:24 PM
    I have something weird happening. When I try to extend a class in a different project, Intellij says it can't find it. but when I just put the import there myself, and extend it. But when I compile it. there isn't a problem. I already restarted Intellij and invalidated the cache
    h
    s
    24 replies · 3 participants
  • s

    Slackbot

    12/05/2019, 8:11 PM
    This message was deleted.
    👎 3
    🛑 3
    r
    m
    2 replies · 3 participants
  • f

    farmerbb

    12/05/2019, 8:19 PM
    If I have two `var`s with the exact same implementation in their setter functions, is it possible to extract that logic out into a single function then assign it as the setter?
    r
    s
    10 replies · 3 participants
  • c

    codeslubber

    12/05/2019, 9:32 PM
    no one has mentioned Space?? looked really good to me.. although perhaps a tad preliminary.. other thoughts?
    t
    a
    +4
    63 replies · 7 participants
  • e

    E.Kisaragi

    12/05/2019, 11:27 PM
    how do we use 'typeof'…?
    j
    s
    2 replies · 3 participants
  • s

    serebit

    12/05/2019, 11:57 PM
    Just read over the blog post for what's in store for Kotlin 1.4, really excited about some of the changes! Bold of you guys to give an estimated release date though, you know how those tend to work out 😛
    👍 4
    :kotlin: 1
    n
    1 reply · 2 participants
  • j

    Joey

    12/06/2019, 1:32 AM
    How to call suspend function from my kotlin library to java (android)? Thanks!
    :google: 3
    j
    2 replies · 2 participants
  • j

    Joffrey

    12/06/2019, 10:50 AM
    Hi guys, is there a stdlib function to create a
    Map<K, List<V>>
    from a
    List<Pair<K,V>>
    ? I'm looking for the same thing as
    toMap()
    , but instead of discarding duplicate keys, it would aggregate the values in a list. For now, I haven't found shorter than this trivial
    groupBy
    :
    fun <K, V> List<Pair<K, V>>.toMapAggregate(): Map<K, List<V>> = groupBy(
        { (k, _) -> k },
        { (_, v) -> v }
    )
    k
    3 replies · 2 participants
  • a

    alexcouch

    12/06/2019, 11:19 AM
    Hey guys! I updated my kotlin native project to 1.3.61 and gradle is freaking out about tag mismatches. At first refreshing my gradle project didn't yield any useful error messages. Just 'Tag mismatch!'. No idea what that meant and google didn't know what it meant either. But I had finally been able to fix it by deleting an unused module (which I was going to start using later on but that's okay I can always get it back later, it's not a big deal) and it started working and download and extracting the new kotlin compiler. Then upon running runReleaseExecutableMingw and now the same problem is occuring but with a better message. Downloading the dependencies just now require multiple attempts to download coming back with an SSLException: Tag Mismatch. It finally resolved itself but I'm just worried about what that means under the hood. Is that a single problem or is it a symptom of the actual problem? I hope it's as simple as clearing/invalidating caches which I haven't tried yet.
    a
    i
    4 replies · 3 participants
Powered by Linen
Title
a

alexcouch

12/06/2019, 11:19 AM
Hey guys! I updated my kotlin native project to 1.3.61 and gradle is freaking out about tag mismatches. At first refreshing my gradle project didn't yield any useful error messages. Just 'Tag mismatch!'. No idea what that meant and google didn't know what it meant either. But I had finally been able to fix it by deleting an unused module (which I was going to start using later on but that's okay I can always get it back later, it's not a big deal) and it started working and download and extracting the new kotlin compiler. Then upon running runReleaseExecutableMingw and now the same problem is occuring but with a better message. Downloading the dependencies just now require multiple attempts to download coming back with an SSLException: Tag Mismatch. It finally resolved itself but I'm just worried about what that means under the hood. Is that a single problem or is it a symptom of the actual problem? I hope it's as simple as clearing/invalidating caches which I haven't tried yet.
a

Artyom Degtyarev [JB]

12/06/2019, 11:26 AM
Hello! What Gradle version you’re using there?
a

alexcouch

12/06/2019, 11:42 AM
At first it was 4.10 and realized I needed to update to 6.0.1, the latest, so I did
i

ilya.matveev

12/06/2019, 11:52 AM
Hello! I never observed similar errors. Do you have any logs of the failed attempts to download dependencies?
a

alexcouch

12/06/2019, 12:46 PM
No unfortunately not right now.
View count: 2