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

    droidrcc

    04/28/2018, 11:15 PM
    I would like to extend
    BaseBuilder
    defining a default implementation for
    onError()
    and hide the
    onError()
    function to the caller
    g
    • 2
    • 2
  • a

    araqnid

    04/29/2018, 1:05 AM
    Why doesn’t the T of
    Comparator<T>
    have input variance? I was trying to assign a Collator (which for some reason is a
    Comparator<Object>
    in Java) to
    Comparator<String>
    . Is it because it’s simply a typealias?
    a
    • 2
    • 3
  • m

    mcblum

    04/29/2018, 1:59 PM
    Does anyone have any good resources on integration testing? I’m very new to Kotlin / Spring and I’m just trying to get my head around testing a basic controller, creating the body of the POST request, etc…
    c
    a
    • 3
    • 14
  • y

    ylemoigne

    04/29/2018, 5:48 PM
    With a multi-module gradle project, when using a multiplatform module, all module which have a (transitive) dependency on the multiplatform module must be using the plugin
    kotlin-platform-jvm
    (and not just
    kotlin
    even if they don't provide any
    actual
    ) ?
    n
    • 2
    • 3
  • c

    Czar

    04/30/2018, 11:18 AM
    can I mark something as @Deprecated for Kotlin, but not for java? I have some java methods which in Kotlin can be made generic utilizing reified types, for that reason I've written kotlin adapters for them. So on call site I'd like java style
    doSomething(Some::class.java)
    to be marked as deprecated in kotlin code, and kotlin-style
    doSomething<Some>
    to be suggested, while in java it should not be marked deprecated.
    o
    • 2
    • 2
  • m

    menegatti

    04/30/2018, 3:01 PM
    although it’s not the complete solution. That can be found here https://youtrack.jetbrains.com/issue/KT-4734
    d
    • 2
    • 1
  • j

    jw

    04/30/2018, 3:02 PM
    honestly just unsafe cast your way to freedom
    s
    • 2
    • 1
  • o

    Otek

    04/30/2018, 4:01 PM
    Huh, my bad.
    k
    • 2
    • 1
  • t

    thomasnield

    04/30/2018, 6:08 PM
    I know I'm going to get a lot of grief over this, but I'm coming to the conclusion Tuples have a place in Kotlin, primarily for quickly improvising key objects in functional operations. https://github.com/thomasnield/kotlin-statistics/issues/23
    k
    • 2
    • 3
  • a

    agrosner

    04/30/2018, 6:21 PM
    some sample would help. but if you want to provide some compatibility with outside consumers:
    typealias Coordinate2D = Triple<Int, Int, String>
    operator fun Coordinate2D.invoke(x: Int, y: Int, description: String) = Coordinate2D(x, y, description)
    r
    • 2
    • 4
  • t

    thomasnield

    04/30/2018, 6:22 PM
    @Shawn But the Tuples are statically typed, just nameless.
    ➕ 1
    s
    • 2
    • 1
  • t

    tipsy

    04/30/2018, 8:16 PM
    is there a more elegant way of doing this?
    if (!::lateObj.isInitialized) lateObj = LateObj()
    k
    • 2
    • 7
  • a

    adams2

    04/30/2018, 8:51 PM
    where can I read more about kotlin_module files
    • 1
    • 3
  • s

    Strum355

    04/30/2018, 10:56 PM
    could someone here give me a quick hand on companion objects?
    s
    • 2
    • 2
  • s

    Strum355

    04/30/2018, 11:12 PM
    maybe theres a better one to use?
    d
    • 2
    • 1
  • s

    Shawn

    05/01/2018, 1:03 AM
    wait, you want to force subclasses to implement a static field?
    a
    • 2
    • 11
  • a

    Aregev2

    05/01/2018, 10:14 AM
    Are there planned fetures to kotlin 1.3?
    d
    n
    • 3
    • 2
  • p

    pbergson

    05/01/2018, 5:59 PM
    what version of the Kotlin plugin are you using?
    b
    • 2
    • 2
  • r

    Ryan Leckey

    05/02/2018, 6:57 AM
    Is there a SQL query builder for Kotlin? Something like Squirrel ( https://github.com/Masterminds/squirrel/blob/v1/README.md ). Anko is close but it lacks support for anything complicated (like joins).
    t
    • 2
    • 1
  • r

    Ryan Leckey

    05/02/2018, 6:58 AM
    I've seen a few typed query builders but they feel too heavy weight to me. I don't want to declare and maintain a schema.
    n
    m
    • 3
    • 3
  • w

    wcaokaze

    05/02/2018, 7:29 AM
    Long
    is a subtype of
    Long?
    r
    • 2
    • 9
  • c

    Czar

    05/02/2018, 7:57 AM
    Is there any indication as to when this will be fixed?
    e: Kotlin home does not exist or is not a directory: 
    > Task :buildSrc:compileKotlin FAILED
    Really annoying 😞
    i
    • 2
    • 2
  • d

    diesieben07

    05/02/2018, 8:21 AM
    How about
    val a = b?.let { A(it) }
    r
    k
    • 3
    • 2
  • c

    Czar

    05/02/2018, 9:04 AM
    you're out of luck then, for most programmers it does 🙂
    r
    k
    e
    • 4
    • 20
  • w

    wcaokaze

    05/02/2018, 9:09 AM
    Swift can compile
    a?.b.toString().length
    to
    if (a == null) {
      null
    } else {
      a.b.toString().length
    }
    c
    • 2
    • 1
  • w

    wcaokaze

    05/02/2018, 9:10 AM
    But I think Kotlin is much more natural…
    r
    k
    +2
    • 5
    • 51
  • k

    karelpeeters

    05/02/2018, 9:10 AM
    Does swift allow
    null.toString()
    ?
    w
    • 2
    • 1
  • r

    robstoll

    05/02/2018, 9:24 AM
    you can in Kotlin as well with a little trick:
    fun Nothing?.toString() = "my personal toString"
    fun main(args: Array<String>) {
        println(null.toString())
    }
    c
    • 2
    • 3
  • l

    lifk

    05/02/2018, 12:58 PM
    Hi, I have a library that every time I use and try to get auto completion it fails with
    org.jetbrains.kotlin.resolve.FunctionImportedFromObject cannot be cast to org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
    s
    n
    c
    • 4
    • 12
  • z

    ziggy42

    05/02/2018, 2:09 PM
    How can I enable
    @JvmDefault
    with gradle?
    d
    • 2
    • 2
Powered by Linen
Title
z

ziggy42

05/02/2018, 2:09 PM
How can I enable
@JvmDefault
with gradle?
d

diesieben07

05/02/2018, 2:13 PM
kotlinOptions {
    freeCompilerArgs = [
        '-Xenable-jvm-default'
    ]
}
z

ziggy42

05/02/2018, 2:14 PM
thanks!!
View count: 2