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

    Hasan

    02/21/2019, 3:36 PM
    Hi.I started to learn Kotlin but my computer doesnt enough to work Intellij.I downloaded Vscode after coderunner extension and Kotlin language extension
    g
    1 reply · 2 participants
  • h

    Hasan

    02/21/2019, 3:39 PM
    Windows path
    s
    k
    +1
    6 replies · 4 participants
  • d

    David Cuesta

    02/21/2019, 3:58 PM
    Hey Guys!! Just a curiosity... I have realized that when I have a class that is used from another package in a file "a.kt" for example, and I want to add an internal class to the same file "a.kt" I receive an error: "Internal is not applicable to local class". Anyone knows the cause?
    h
    3 replies · 2 participants
  • a

    amadeu01

    02/21/2019, 6:35 PM
    I just found out http://play.kotlinlang.org/ It remembers me the Xcode playground. i'm wondering is there anything like Xcode Playgrounds to intelliJ wih kotlin ?
    :kotlin: 1
    s
    l
    +1
    8 replies · 4 participants
  • d

    Danilo Herrera

    02/21/2019, 6:52 PM
    Is there a way to ensure a generic type is a data class?
    :no_red: 2
    r
    d
    +2
    9 replies · 5 participants
  • t

    teasp00n

    02/22/2019, 2:43 AM
    is it accurate to say that coroutines are kotlins implementation of green threading or is it different/ more than that?
    s
    k
    +1
    4 replies · 4 participants
  • c

    camdenorrb

    02/22/2019, 2:56 AM
    How do I enable Kotlin Native optimizations in Kotlin Gradle?
    s
    s
    2 replies · 3 participants
  • e

    elect

    02/22/2019, 9:09 AM
    is there a trick to assign a value to a variable with a custom setter without triggering it?
    c
    p
    +1
    7 replies · 4 participants
  • a

    Animesh

    02/22/2019, 12:23 PM
    Can any one suggest image tagging library in Android ?
    :google: 4
    l
    2 replies · 2 participants
  • u

    Uraniam9

    02/22/2019, 2:20 PM
    How to test kotlin code in android studio
    :google: 4
    r
    f
    +1
    3 replies · 4 participants
  • i

    itasyurt

    02/22/2019, 3:10 PM
    Is there any suggested way to replace this? or should we continue with newFixedThredPoolContext (or java style executors)
    j
    2 replies · 2 participants
  • r

    Rob

    02/22/2019, 5:15 PM
    abstract class A()
    class B(): A()
    class C(): A()
    
    fun foo(b: B)
    fun foo(c: C)
    If I have something like this, a base class with subclasses and overloaded functions, what is the "best" way to call it IF they are stored in a variable of type A?
    class Something(val member: A)
    
    val v = Something(B())
    
    foo(v.member) // How to get this to call the right foo
    d
    n
    30 replies · 3 participants
  • f

    Francesco megna

    02/22/2019, 7:57 PM
    Hi guys, anyone know a good library for Reactive programming in Kotlin? excluding RxJava and RxKotlin wrapper
    l
    c
    +4
    14 replies · 7 participants
  • b

    bootstraponline

    02/23/2019, 1:37 AM
    when I remove the "optional" param, the green run button goes away. Is there an issue tracking this?
    g
    i
    3 replies · 3 participants
  • h

    Hauke Radtki

    02/23/2019, 10:33 AM
    Is there a way to re-use the kotlin serialization feature to deserialize an object from a Map<String,Any?> ? Since I'm using data classes I can't use delegated properties.
    n
    c
    6 replies · 3 participants
  • i

    igor.wojda

    02/23/2019, 4:45 PM
    Can
    maxDigits
    function be simplified? I want to find what is the longest digit in the list and return length of that digit. Method works but can it be done using kotlin stdlib functions without using digit length (
    digitCount
    ) twice ?
    val Int.digitCount get() = this.toString().length
    
    fun maxDigits(list: List<Int>): Int = list.maxBy { it.digitCount }?.digitCount ?: 0
    d
    s
    +1
    17 replies · 4 participants
  • f

    FalseHonesty

    02/23/2019, 4:58 PM
    I'm getting a weird error when trying to build a Kotlin project using gradle, where would I ask for support on this issue?
    h
    i
    6 replies · 3 participants
  • m

    muralimohan962

    02/24/2019, 4:24 AM
    It doesn't work as expected. It will still call the same object's method. The lint warning is correct. This is because a final field of the delegate is created so it can't be modified even though your sent field is mutable.
    👍 1
    d
    1 reply · 2 participants
  • s

    Slackbot

    02/24/2019, 6:24 AM
    This message was deleted.
    c
    h
    2 replies · 3 participants
  • p

    PHondogo

    02/24/2019, 9:58 AM
    Hello! I have multiplatform project and publish it to maven repository. Now i want in another project's common module to depend on common module of published project. How can I write dependency if there is no common artifact published. Only jvm and js were published.
    l
    d
    5 replies · 3 participants
  • j

    jkbbwr

    02/24/2019, 1:16 PM
    I want the wrap to behave correctly.
    d
    5 replies · 2 participants
  • j

    jkbbwr

    02/24/2019, 1:39 PM
    meh
    k
    1 reply · 2 participants
  • s

    Systemkern

    02/24/2019, 3:58 PM
    @jkbbwr @karelpeeters and @Dico please use threads when replying to messages. This way the main feed does not get spammed unnecessary 😱 Thanks 😀👍
    ➕ 2
    a
    d
    6 replies · 3 participants
  • s

    Sam

    02/24/2019, 4:54 PM
    I know there was a plan for compiler plugins for future. As of now, it is possible to have custom annotation applied to kotlin code for java code generation?
    d
    u
    +1
    7 replies · 4 participants
  • b

    bjonnh

    02/24/2019, 6:31 PM
    @Casey Brooks: I'm trying your tutorial (https://dev.to/cjbrooks12/how-to-document-a-kotlin-project-edc) but applied to my project. Everything works fine except that it refuses to read my config.yml . Any idea what could be wrong? It finds the wiki, it finds the README integration, but it doesn't take anything I put in the config.yml
    c
    5 replies · 2 participants
  • a

    Andrew Gazelka

    02/24/2019, 6:33 PM
    is there any way with delegates to get
    KProperty
    before
    getValue(...)
    ? I want certain updates to occur before the variable is first accessed, and I need the property name to do this.
    d
    2 replies · 2 participants
  • c

    camdenorrb

    02/24/2019, 7:38 PM
    Is there any way to get the calling classloader in an package level util function?
    g
    d
    12 replies · 3 participants
  • r

    Rômero Ricardo

    02/25/2019, 11:59 AM
    Hi everybody, is there any certificate available to be taken for Kotlin? Any recommendation about book and institution specifically for certificate?
    v
    c
    3 replies · 3 participants
  • j

    Jan

    02/25/2019, 12:13 PM
    is there a way to get a java::class for nullable types for annotation checking?
    __class_java.kt
    k
    d
    5 replies · 3 participants
  • t

    thana

    02/25/2019, 1:34 PM
    is it possible to write a contract where somthing implies, that a method will not return
    null
    ? (all examples i can find implie the other way round)
    l
    s
    12 replies · 3 participants
Powered by Linen
Title
t

thana

02/25/2019, 1:34 PM
is it possible to write a contract where somthing implies, that a method will not return
null
? (all examples i can find implie the other way round)
l

LeoColman

02/25/2019, 1:36 PM
I think that if by design your method can either be nullable or no-nullable, depending on a variable
Maybe your design is not correct, and you should refactor the two cases
t

thana

02/25/2019, 1:36 PM
damn, that would be far easier, thats right 😄
l

LeoColman

02/25/2019, 1:36 PM
Can you show us an example of what you're trying to do?
t

thana

02/25/2019, 1:37 PM
in fact you are just right - i should split it into two methods. you know that sitautions where you feel really stupid for not seeing the obvious? 😂
s

streetsofboston

02/25/2019, 1:40 PM
Oh... we've all been there, Malte! :-D
l

LeoColman

02/25/2019, 1:43 PM
And we'll be there many more times
Classic http://xyproblem.info/ perhaps?
t

thana

02/25/2019, 1:49 PM
na not really... the emssage has a boolean flag (which is bad on it's own, too), and when it's
false
it will return a non-null value - always. i knew this smeels before, but then i saw a colleague using it, and he had to use
?.
all over the place and i though "hey this is kotlin! it has a cool feature that might solve this problem" and didn't realise it would be much easier to simply split the method into two
so... maybe.. it's excactly the problem 🤷
l

LeoColman

02/25/2019, 1:56 PM
I like how Kotlin makes some code smells even more smelly hahaha
😁 1
t

thana

02/25/2019, 1:59 PM
😄
View count: 2