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
announcements
  • c

    cedric

    12/03/2017, 4:09 AM
    Kotlin doesn't natively support sum types, so using
    Either
    is still error prone: the compiler won't prevent you from accessing the field that's not been set
    r
    • 2
    • 2
  • a

    Andreas Sinz

    12/03/2017, 12:31 PM
    @robstoll any reason you need to specify the type?
    r
    c
    r
    • 4
    • 11
  • k

    karelpeeters

    12/03/2017, 8:17 PM
    Put a
    .bat
    in the user's startup folder that runs the jar file.
    g
    • 2
    • 4
  • a

    aljosa

    12/04/2017, 2:21 AM
    i’m looking for an android application (source) which uses fragments dynamically/at runtime. official java tutorials for android and other resources i’ve found are always missing some part. i’d like to learn from a full example using the best practices for kotlin/android, any suggestions?
    a
    • 2
    • 2
  • d

    Dizarray

    12/04/2017, 4:28 AM
    Hi, I have this code:
    class DefaultList(val name: String = "", val friends: List<String>)
        
        class ListDefault(val friends: List<String>, val name: String = "")
        
        fun foo() {
            val instance = DefaultList(arrayListOf("blah"))
            val another = ListDefault(arrayListOf("blah"))
        }
    Line, where I create
    instance
    variable doesn't compile. But line with creating
    another
    variable is ok. Do I really need to have a variable with default value at the end of primary constructor or is it a bug?
    c
    • 2
    • 1
  • k

    kirillrakhman

    12/04/2017, 8:45 AM
    there's a 2017.3.1 EAP. the changelog said something about freezes
    j
    • 2
    • 1
  • q

    qwert_ukg

    12/04/2017, 9:31 AM
    or maybe somebody can advise a good java lib for it?
    d
    c
    +2
    • 5
    • 8
  • q

    qwert_ukg

    12/04/2017, 9:45 AM
    what do think guys, about this lib https://github.com/KDatabases/Kedis
    👎 2
    r
    t
    b
    • 4
    • 10
  • r

    rrader

    12/04/2017, 10:10 AM
    Why in Kotlin companion objects can implements some interfaces, what benefits this can have? When is useful to use this feature?
    g
    c
    • 3
    • 8
  • d

    Dario Pellegrini

    12/04/2017, 10:41 AM
    @qwert_ukg look interesting. I must try it!
    q
    • 2
    • 1
  • a

    alexcouch

    12/04/2017, 3:40 PM
    For some reason I can't seem to get line breaks in my kotlin documentation
    d
    a
    t
    • 4
    • 11
  • s

    snowe

    12/04/2017, 5:34 PM
    incomes:
        HOURLY_SALARY_BASE_WAGE_INCOME:
        - types: "PAYSTUB"
        - types: "W2"
    a
    l
    • 3
    • 13
  • b

    bkenn

    12/04/2017, 7:59 PM
    Hi all. I'm trying out the multi-platform feature and I am getting the following error.
    Error:(3, 1) Kotlin: The feature "multi platform projects" is experimental and should be enabled explicitly.
    I cannot find any documentation on where to enable multiplatform build. I tried
    kotlin {
        experimental {
            multiplatform 'enable'
        }
    }
    but this doesn't work. Anyone run into this issue?
    c
    • 2
    • 6
  • b

    bj0

    12/04/2017, 8:46 PM
    removeAt
    implies passing an index though ?
    👍 1
    k
    s
    +2
    • 5
    • 15
  • k

    karelpeeters

    12/04/2017, 8:48 PM
    @Czar How would I use that?
    c
    • 2
    • 1
  • k

    karelpeeters

    12/04/2017, 9:04 PM
    As I'm doing right now:
    tipList = tipList.dropAt(index)
    d
    • 2
    • 6
  • k

    karelpeeters

    12/04/2017, 9:06 PM
    You can make "non-structural modifications". I'm still amazed by how well the Java Collections are designed and specified.
    ➕ 2
    c
    • 2
    • 1
  • k

    karelpeeters

    12/04/2017, 10:45 PM
    For you specific use case:
    if (str.isNullOrBlank()) "other" else str
    s
    m
    • 3
    • 4
  • p

    pniederw

    12/05/2017, 1:41 AM
    @blakelee did you read https://kotlinlang.org/docs/reference/generics.html#use-site-variance-type-projections ?
    b
    • 2
    • 2
  • q

    qwert_ukg

    12/05/2017, 7:44 AM
    can u compile it?
    h
    c
    • 3
    • 14
  • o

    oblakr24

    12/05/2017, 8:58 AM
    Hi IntelliJ(/AndroidStudio) Kotlin plugin team, currently, autogenerating of objects implementing interfaces (say, in method calls when you want to provide an implementation of a callback interface) does not work in Kotlin (it works fine in Java). Is this a known issue and are there any plans to include this?
    k
    • 2
    • 1
  • p

    pdegand

    12/05/2017, 10:59 AM
    Hi, generic Java/Kotlin question: Can I always swap the usage of a
    ByteArray
    to a
    String
    and the otherway arround ? I'm doing some crypto and
    Cipher
    is using
    ByteArray
    as its input but i want to put the input inside a
    data class
    and
    data class
    are not happy with
    Arrays
    . So can i simply convert the the ByteArray to string to store inside my data class and re-convert the string to bytearray when i need to pass it to a cipher ?
    p
    • 2
    • 1
  • r

    r4zzz4k

    12/05/2017, 11:39 AM
    Is there any information on UAST besides IDEA and lint source code?
    y
    • 2
    • 2
  • n

    nfrankel

    12/05/2017, 2:20 PM
    anyone tried to use the kotlin ant task? it uses the
    KotlinAntTaskUtil.kt
    file under the cover which checks for the existence of files, not classes on the classpath 1. i’ve to rename files and lose versions, i can live with that 2. i cannot use the embeddable compiler, and run into classpath issues regarding conflicting guava versions ok, this is very specific still, hints appreciated
    u
    • 2
    • 5
  • d

    danielspeixoto

    12/05/2017, 9:06 PM
    Does anyone knows a good lib for Mongodb?
    c
    • 2
    • 6
  • g

    g4sarma

    12/05/2017, 10:23 PM
    Guys was this ever fixed https://stackoverflow.com/questions/1503284/java-system-getpropertyuser-home-returns?
    o
    a
    n
    • 4
    • 7
  • e

    edwardwongtl

    12/06/2017, 8:17 AM
    Just a quick survey, what library do you use for unit test? Plane old jUnit or anything else?
    c
    j
    +7
    • 10
    • 12
  • k

    kael

    12/06/2017, 11:36 AM
    I managed to miss the AMA by mere minutes, so I'm hoping this is the right channel to ask this question. Is it possible (or are there plans) to have some sort of Swift-style
    deinit
    in Kotlin/Native?
    s
    • 2
    • 2
  • a

    arild

    12/06/2017, 12:35 PM
    I would like to hear opinions on explicitly returning Unit from a method to indicate an intentional no-op implementation, e.g.
    override fun onCompleted() = Unit
    👍 1
    s
    • 2
    • 1
  • n

    noncom

    12/06/2017, 2:41 PM
    what library for client-side HTTP requests would you recommend for Kotlin?
    n
    n
    d
    • 4
    • 12
Powered by Linen
Title
n

noncom

12/06/2017, 2:41 PM
what library for client-side HTTP requests would you recommend for Kotlin?
n

natpryce

12/06/2017, 3:52 PM
We’re using http4k over apache http client. http4k uses the same API for incoming and outgoing requests, which is very handy when writing proxies, or even common utility code that can be applied to any http message
n

napperley

12/06/2017, 8:47 PM
Alex - Are you referring to a HTTP client on the server-side?
n

noncom

12/07/2017, 9:39 AM
@natpryce wow, thanks! for some reason searching for Kotlin http client libraries only revealed the Fuel library which we are currently using, but which is not actively maintained and gives us big surprises from time to time
@napperley not sure what is a HTTP client on a server side 🙂 Maybe there is a typo. What I mean is that I have a desktop application that needs talking to REST APIs over the network, and that I am looking for a Kotlin library to help me implement this part
d

deviant

12/07/2017, 11:09 AM
Retrofit
➕ 1
n

noncom

12/07/2017, 4:23 PM
hmmm, Retrofit uses annotations a lot
and that would mean that everything is hard-coded at compile time
in the project I am currently developing, the API interfaces should be built from random dynamically updated specs and should be made available in various scripting languages, like Lua and other
I am not sure how to tie this up with code on annotations
d

deviant

12/07/2017, 5:25 PM
retrofit is extremely flexible
anyway you can use okhttp directly if you dont need rest client
n

noncom

12/07/2017, 10:31 PM
Yeah! Gonna try Retrofit too. First-hand experience would be great!
View count: 4