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
  • p

    Peter Ertl

    05/18/2021, 10:08 AM
    does anybody know if mockk v1.11.0 supports mocking inline value classes? it seems it does not…
    c
    e
    y
    • 4
    • 17
  • t

    thanksforallthefish

    05/18/2021, 12:44 PM
    how can it be? I looked for a data class in intellij and it found 28 usages, 21 instance creation. then I hit refactor constructor (cmd+f6 on mac), now I am witnessing at looking for usages since 5 minutes. a lot seems due to components scanning, but it also seems like idea is analysing completely unrelated code. does anybody know of a related yt? I tried to look briefly, but not really sure what to look for actually
    c
    a
    • 3
    • 4
  • j

    Jose A.

    05/18/2021, 4:52 PM
    Hi there! I got this code:
    @OptIn(ExperimentalContracts::class)
        private fun OriginQueryNode.isSimpleQuery(): Boolean {
            contract {
                returns(true) implies (this@isSimpleQuery is OriginQueryNode.FilterAttributes)
            }
            return this is OriginQueryNode.FilterAttributes && ...
        }
    
        private fun calculateMembersLocallyIfPossible(originQuery: OriginQueryNode): MemberGaussCollection? =
            if (originQuery.isSimpleQuery()) {
                println(originQuery.fieldOnlyFilterAttributes)
            }
    In the `calculateMembersLocallyIfPossible`fun I try to access the field `fieldOnlyFilterAttributes`after checking
    isSimpleQuery
    is true. The contract should let me access the field but it's not working (marks
    fieldOnlyFilterAttributes
    as not existent.
    n
    • 2
    • 16
  • u

    user

    05/18/2021, 4:56 PM
    message has been deleted
    :kotlin-intensifies: 16
    c
    k
    • 2
    • 3
  • s

    spierce7

    05/18/2021, 8:30 PM
    Why was the change made for Duration from
    2.seconds
    to
    Duration.seconds(2)
    ? One is significantly less convenient to use.
    n
    p
    +2
    • 5
    • 9
  • z

    zain

    05/19/2021, 8:27 AM
    How to get instance of
    this
    within a lambda expression
    val sectionChildAdapter = SectionChildAdapter {
        callBackListener.invoke(it)
         this.notify(l)
    }
    m
    n
    • 3
    • 14
  • j

    Jason5lee

    05/19/2021, 10:15 AM
    Is there an unfold equivalent in Kotlin? F# definition:
    val unfold: 
       generator: 'State -> option<'T * 'State> ->
       state    : 'State 
               -> seq<'T>
    t
    s
    n
    • 4
    • 8
  • j

    Jiri Bruchanov

    05/19/2021, 3:12 PM
    Hi, anyone who would know if it's possible to do following in kt syntax ?
    b
    • 2
    • 5
  • u

    user

    05/19/2021, 4:54 PM
    message has been deleted
    :kotlin-intensifies: 7
    👍 5
    c
    d
    • 2
    • 2
  • m

    Mike Vitale

    05/19/2021, 9:11 PM
    If I have an
    object
    that declares many `const val`’s in my Kotlin code, is it possible to star-import all of them into a class that uses them?
    e
    m
    +3
    • 6
    • 14
  • e

    Erik

    05/19/2021, 10:18 PM
    This playground example from the design notes on KEEP-237 (value classes) behaves differently on v1.5.0 and v1.4.30: https://github.com/Kotlin/KEEP/blob/497c86126b7320f3651807eb070f5efe80bcdb3a/notes/value-classes.md#L123-L135 (note that you might have to change the playground settings before running for it to work as expected) It prints
    true
    false
    on v1.4.30, but on v1.5.0 it prints
    true
    true
    Why? What part of the v1.5.0 release changed this behaviour?
    e
    • 2
    • 2
  • u

    ursus

    05/20/2021, 12:51 AM
    Any clue what this is? Compiles fine
    b
    c
    u
    • 4
    • 5
  • e

    eygraber

    05/20/2021, 4:34 AM
    Is there a faster than usual bug release planned for Kotlin 1.5.0? It seems like there are a bunch of issues (memory leaks, version issues and clashes, etc...) with the gradle and IDEA plugins that make development pretty miserable.
    a
    • 2
    • 2
  • ł

    Łukasz Bednarczyk

    05/20/2021, 7:03 AM
    Hi 🙂 I’m looking for a list of countries which block google services - like translate-api. I know that many services is block in China (without Hong Kong). Do you know about another countries?
    🤦 1
    :not-kotlin: 3
    i
    • 2
    • 1
  • n

    Nicole

    05/20/2021, 10:47 AM
    I’m curious if it’s possible to create something in Kotlin where a stream of values is emitted only when one is requested. So something like
    iterator { produceValue() }
    where produceValue is called each time the consumer calls
    next()
    r
    e
    • 3
    • 4
  • g

    Gopal S Akshintala

    05/20/2021, 1:25 PM
    What’s the annotation that can help in this case, for Java interoperability?
    org.jetbrains.annotations.NotNull
    doesn’t work on Generic param types 😞
    fun someFun(list: List<@NotNull String>)
    a
    • 2
    • 7
  • a

    ahmad abas

    05/20/2021, 2:50 PM
    what is the better option between web framework : spring, http4k or ktor? Im interested to learn ktor due to the hype but i saw a comment in reddit thread stating the ktor docs is worse than others is that still the case?? I have experience in go, elixir and python
    e
    • 2
    • 1
  • a

    ahmad abas

    05/20/2021, 2:51 PM
    and can someone share a good kotlin short ref guide (minimal read before jump to project) like gobyexample.com or elixirschool.com would be helpful. thank you 🙂
    h
    • 2
    • 2
  • d

    Denys

    05/20/2021, 5:52 PM
    Help me please. I am trying to update kotlin to version “1.5.0” and kotlinx-serialization-json to version “1.2.0" . After the update, the project stopped building - “java.util.NoSuchElementException: Collection contains no element matching the predicate. at org.jetbrains.kotlinx.serialization.compiler.backend.ir.IrBuilderExtension$DefaultImpls.serializableSyntheticConstructor(GeneratorHelpers.kt:1255)”
    g
    • 2
    • 3
  • c

    cuongtd

    05/21/2021, 4:27 AM
    could anyone please tell me where to add dependency for console project?
    g
    • 2
    • 8
  • d

    dead.fish

    05/21/2021, 9:48 AM
    I’m wondering, it is possible somehow to link / reference resource files (i.e. files underneath
    src/{main,test}/resources
    ) with KDoc? In case things get moved / renamed, so that documentation entries will reflect this change automatically?
    j
    • 2
    • 3
  • t

    Tudor Luca

    05/21/2021, 11:27 AM
    I’m looking for a way to generate "test data as source code" based on real server http responses. Basically I want to serialise objects from memory as source code. eg: I have a
    data class MyObject(val value: Int)
    and 10 objects in memory I want to generate a
    data.kt
    file like :
    val obj1 = MyObject(value = 1)
    val obj2 = MyObject(value = 12)
    val obj3 = MyObject(value = 3)
    etc
    Context: Jetpack Compose Previews cannot access the file system, so you'd need test data as Kotlin source code, you cannot use a JSON file and parse it, as you would do in a normal junit test. This would be useful as a JVM CLI companion tool when you want complex test data based on a server response that would be tedious to type by hand.
    b
    j
    n
    • 4
    • 31
  • s

    solidogen

    05/21/2021, 12:51 PM
    I would like to disable automatic import of stdlib’s Result class, as I have my own implementation, but imports are always breaking as stdlib implementation has priority. Anyone knows how to deal with this?
    b
    v
    • 3
    • 3
  • n

    Nikola Milovic

    05/21/2021, 12:55 PM
    I am not fully understanding the KMM setup guide.
    If you need to write iOS-specific code and run an iOS application
    , so on a Linux machine I can only write android specific code? My idea is to have domain/data layers be shared and only separate UI for IOS/ Android. Android with Jetpack compose and IOS probably swiftUI (which would require XCode). From my understanding so far, I need to develop on MacOS if I want to both target IOS and Android at the same time? Can someone help clarify this situation
    j
    m
    +3
    • 6
    • 14
  • g

    Gopal S Akshintala

    05/22/2021, 7:52 AM
    Now that bintray is gone, where are dev builds hosted? (like
    1.5.30-dev-1046
    ) ?
    maven("<https://dl.bintray.com/kotlin/kotlin-eap>") or maven("<https://dl.bintray.com/kotlin/kotlin-dev>")
    doesn’t seem to be working anymore
    e
    v
    m
    • 4
    • 14
  • c

    CLOVIS

    05/22/2021, 4:24 PM
    Hi! Does anyone here use Let'sPlotKotlin? I'm not sure what the correct channel is
    i
    • 2
    • 1
  • s

    spierce7

    05/23/2021, 12:14 AM
    The stdlib is automatically added to projects now, right?
    :yes: 6
    b
    • 2
    • 1
  • s

    Slackbot

    05/24/2021, 6:34 AM
    This message was deleted.
    n
    g
    • 3
    • 2
  • u

    user

    05/24/2021, 2:30 PM
    message has been deleted
    :party-parrot: 6
    y
    • 1
    • 1
  • u

    user

    05/24/2021, 3:50 PM
    message has been deleted
    l
    • 1
    • 1
Powered by Linen
Title
u

user

05/24/2021, 3:50 PM
message has been deleted
l

louiscad

05/24/2021, 5:03 PM
German speakers might have fun with such a name!
😂 4
🙈 3
💩 1
View count: 4