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

    diesieben07

    03/22/2018, 1:32 PM
    Maybe delegation?
    class Impl1(impl2: Impl2) : SomeInterface by impl2
    u
    • 2
    • 3
  • g

    geoffrey

    03/22/2018, 5:06 PM
    I’m looking at at Kotlin code sample, and I’m seeing
    is
    used with optional types, which I don’t quite get:
    if( myvar is MyObject? )
    . Seems to be valid syntax, but I don’t understand what the
    ?
    is adding. Any thoughts?
    l
    h
    +2
    • 5
    • 12
  • k

    kagomez

    03/23/2018, 12:14 AM
    hey guys, has anyone integrated https://github.com/arturbosch/sonar-kotlin and Jacoco test coverage?? I need help with this
    t
    • 2
    • 6
  • d

    dead.fish

    03/23/2018, 8:21 AM
    because I don't have
    SomeClass
    , but only an instance (actually an
    object
    ) of that class
    e
    a
    r
    • 4
    • 7
  • s

    spand

    03/23/2018, 8:22 AM
    objOfSomeClass::class.safeCast(otherInstance) != null
    d
    • 2
    • 6
  • d

    dead.fish

    03/23/2018, 8:23 AM
    and
    it::class.isInstance(value.type)
    apparently needs
    kotlin-reflect
    , which I don't want to draw in just for that purpose
    e
    • 2
    • 7
  • s

    Shawn

    03/23/2018, 2:34 PM
    that’s what’s known as a
    zip
    operation
    👍🏾 2
    h
    • 2
    • 4
  • j

    jw

    03/23/2018, 7:48 PM
    #kapt or kotl.in/issue
    👍 1
    t
    • 2
    • 1
  • c

    czyzby

    03/24/2018, 12:46 PM
    Is there anything close to union types when defining external JS function definitions?
    b
    • 2
    • 1
  • j

    Jean-Philippe Déry

    03/24/2018, 7:29 PM
    To anyone, I'm not sure if this is a bug in kotlin or if I'm missing something here
    a
    • 2
    • 1
  • a

    altavir

    03/25/2018, 6:37 AM
    I am feeling really stupid, but I am still struggling with declaration site variance in some places. I have a node-like object of a type
    T
    and it could produce other nodes that could possibly extend
    T
    . Then I have a builder object for that tree that could consume
    T
    or something extending T:
    class Tree<T>{
      fun getNode(name: String): Tree<T>
    }
    
    class Builder<T>{
      fun setNode(name: String, tree: Tree<T>)
    }
    In first case I can possibly work without variance at all, but in second case I need some kind of variance to be able to put nodes of
    something: T
    inside. How should I do it? Just putting
    in
    variance in class header does not work.
    k
    i
    • 3
    • 20
  • p

    pal0810

    03/25/2018, 1:39 PM
    can anyone recommend me a fast track course for android using kotlin. ps: wanna build an online laundry platform
    c
    • 2
    • 1
  • t

    Toby

    03/25/2018, 5:55 PM
    https://stackoverflow.com/questions/42393718/styling-search-view-on-android-min21/42519398#42519398
    c
    • 2
    • 1
  • m

    mekarthedev

    03/25/2018, 7:21 PM
    I get
    Type parameter T is declared as 'out' but occurs in 'in' position in type T
    on line
    override fun receive(t: T) {
    i
    • 2
    • 1
  • t

    thanksforallthefish

    03/26/2018, 6:28 AM
    is there any reference roadmap (or similar) on kotlin supports for new java versions? now that java plans to release in 6 months releases, I am kinda worried people (colleagues) may start complaining if kotlin is not there immediately after the release. I am trying to introduce kotlin in our backend applications. I personally don't see the need too much, but some of them may want to keep writing java code, so we would have projects where some code is kotlin and some is java
    s
    • 2
    • 3
  • d

    DeividasDuda

    03/26/2018, 9:05 AM
    Hello Clever Minds, I am reading from google spreadsheets with kotlin and get the following error:
    java.lang.NullPointerException`
    at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213)
    at com.google.api.client.util.Preconditions.checkNotNull(Preconditions.java:127)
    g
    • 2
    • 3
  • d

    DeividasDuda

    03/26/2018, 9:09 AM
    I run the code that does exactly the same in java and it works, now when I use kotlin it gives the error
    g
    • 2
    • 1
  • s

    sarahpoehler

    03/26/2018, 6:19 PM
    https://pastebin.com/wf2nQab8
    a
    • 2
    • 4
  • s

    sarahpoehler

    03/26/2018, 6:24 PM
    @Shawn val -> var
    s
    • 2
    • 2
  • c

    colintheshots

    03/26/2018, 6:27 PM
    Is there any way to override a java constructor's initialization? I know you can override methods with the object : Class() syntax.
    • 1
    • 1
  • j

    Joe

    03/26/2018, 6:41 PM
    I copied some Java code and Android Studio automatically converted it for me, but fit doesn’t seem to work and my grasp of generics in Kotlin isn’t strong enough to understand why. Here’s the Java:
    if (!(raw instanceof Map)) {
        ...
    }
    And here’s the converted Kotlin:
    if (raw !is Map<*, *>) {
       ...
    }
    Now the variable
    raw
    is actually of type
    LinkedHashTreeMap
    which inherits from
    Map
    . What am I missing?
    i
    s
    • 3
    • 12
  • a

    Adrian M

    03/27/2018, 7:45 AM
    Does anyone know more about https://blog.pusher.com/announcing-state-kotlin-survey/ ? It's been almost 3 weeks since ending of the survey
    n
    z
    • 3
    • 9
  • d

    diesieben07

    03/27/2018, 11:08 AM
    What you're looking for will happen with inline classes.
    e
    • 2
    • 5
  • g

    gildor

    03/27/2018, 1:55 PM
    What kind status? Work in progress, will be available when will be ready
    👍 1
    e
    • 2
    • 5
  • k

    Konstantin Petrukhnov

    03/27/2018, 2:41 PM
    Is it possible to have data class (so i could use copy) without default parameters?
    s
    • 2
    • 1
  • d

    droidrcc

    03/27/2018, 3:37 PM
    At line 6, how can I access to the callback field ?
    s
    g
    • 3
    • 5
  • p

    perryprog

    03/27/2018, 5:11 PM
    Is there any simple way I can read from stdin without blocking? Maybe something like
    readStuff {
        println(it)
    }
    // Do other things meanwhile...
    k
    g
    • 3
    • 6
  • q

    qwert_ukg

    03/28/2018, 4:14 AM
    how to mock first class functions using mockito ?
    👍 1
    g
    • 2
    • 3
  • v

    vibin

    03/28/2018, 7:26 AM
    Does it ever make sense to use double-bang (!!) after safe operator (?.) in a kotlin expression, considering non-nullable properties of a nullable receiver are nullable?
    class Foo(val bar: Bar)
    var foo: Foo? = null 
    foo?.bar!! // will crash when foo is null 💀
    p
    • 2
    • 4
  • r

    rrader

    03/28/2018, 1:44 PM
    What code style do you prefer 1

    https://pbs.twimg.com/media/DZYF8XQWAAAUuT2.jpg▾

    2
    join(who='jonnyzzz', when=Today, where=Linz, talks=listOf("Live coding and IntelliJ IDEA"))
    d
    • 2
    • 1
Powered by Linen
Title
r

rrader

03/28/2018, 1:44 PM
What code style do you prefer 1

https://pbs.twimg.com/media/DZYF8XQWAAAUuT2.jpg▾

2
join(who='jonnyzzz', when=Today, where=Linz, talks=listOf("Live coding and IntelliJ IDEA"))
d

dasz

03/28/2018, 2:37 PM
join 'Jonnyzzz' Today in Linz regarding 'Live coding..'
View count: 1