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

    nfrankel

    04/16/2018, 7:26 PM
    i’d write that:
    interface Database {
        fun getFoo(): String
    }
    
    class MutableDatabase(internal var foo: String) : Database {
        override fun getFoo() = foo
    }
    
    class ImmutableDatabase(internal val foo: String) : Database {
        override fun getFoo() = foo
    }
    g
    • 2
    • 2
  • s

    Shawn

    04/16/2018, 7:27 PM
    why internal?
    n
    • 2
    • 3
  • c

    Caleb Allen

    04/16/2018, 8:31 PM
    My proof of concept for this project is just styling HTML and converting it into a PDF but it's like shooting from the hip for page alignment, etc
    d
    • 2
    • 3
  • c

    Caleb Allen

    04/16/2018, 8:34 PM
    I'm hoping I can avoid needing to create my own templating/styling engine dealing with raw PDFs, and just designate template items within the designer's workflow and fill it with kotlin, but I've been keeping my eye on PDF Box or iText if it comes down to it
    p
    • 2
    • 4
  • p

    perryprog

    04/17/2018, 1:12 AM
    Any recommendations for a good REST api framework? I’ve heard of ktor, but I’m wondering if there’s any other good options.
    s
    • 2
    • 1
  • x

    x80486

    04/17/2018, 1:14 AM
    Vert.x is pretty amazing...more like a toolkit 🎉
    s
    • 2
    • 2
  • g

    ghedeon

    04/17/2018, 9:38 AM
    anything special about annotations on properties in interfaces? I'm getting
    This annotation is not applicable to target 'member property without backing field or delegate'
    when I try to add
    @DrawableRes
    to an interface property
    g
    • 2
    • 2
  • a

    andyb

    04/17/2018, 3:28 PM
    Is this class created from Kotlin source code?
    d
    • 2
    • 15
  • d

    dave08

    04/17/2018, 3:33 PM
    I was thinking of Comparables, but that may not be so efficient, or binary searching, but I've also never used either in Kotlin and wouldn't know how's the best way to do this...
    • 1
    • 1
  • r

    rrva

    04/17/2018, 3:37 PM
    If I want to invoke a javascript function from kotlin, in a kotlin app running on the jvm, how do I do this?
    a
    • 2
    • 1
  • c

    Chris Margonis

    04/17/2018, 4:58 PM
    Uhm this may sound dumb, but is it possible to use a
    lateinit var
    inside a
    by lazy {...}
    block of another
    val
    ? I get the
    UninitializedPropertyAccessException
    when the class is being created.
    a
    • 2
    • 2
  • r

    rogeralsing

    04/17/2018, 6:41 PM
    are there breaking changes between 1.2.30 and 1.2.31? my intellijplugin seems to be 1.2.31 while the maven deps wants 1.2.30 (? I have no idea what is going on)
    a
    • 2
    • 3
  • t

    thatadamedwards

    04/17/2018, 7:05 PM
    so then the element we’re adding is outside of the elements inside of the list we already have, right?
    g
    • 2
    • 1
  • i

    ilya.gorbunov

    04/17/2018, 8:09 PM
    @ghedeon You can use
    .apply
    function if you want to insert something in the middle of fluent call chain:
    someList
        .doSomething()
        .apply { if (condition) add(element) }
        .doSomethingElse()
    😮 2
    👏 1
    a
    g
    • 3
    • 2
  • k

    k4k4_dev

    04/18/2018, 12:17 PM
    anyone 🙂 https://discuss.kotlinlang.org/t/object-vs-object-declaration/7461 ?
    • 1
    • 1
  • f

    felislynx

    04/18/2018, 12:58 PM
    Hi there, i'm trying to understand generics inside kotlin and i'm blocked. Given sample below i wanted to use in base class my FooList as param and extend this class where i'm using BarList. But i'm unable to
    open class Foo {
    
    }
    class Bar:Foo(){
    
    }
    open class FooList {
    	open var list:List<Foo>?=null
    }
    class BarList:FooList(){
    	override var list:List<Bar>?=null
    }
    open class BaseTest {
     open var llist:List<FooList>?=null
    }
    class BaseTestTwo : BaseTest {
    	override var llist:List<BarList>?=null
    }
    a
    • 2
    • 23
  • m

    Michael

    04/18/2018, 1:42 PM
    What is the cleanest way work with a chain of
    Optionals
    when you need to hang on to intermediate values? (“Promise Hell” in JavaScript) Sample:
    return receiptRepository.findOne(receiptId)
        .map { lineRepository.findOne(it, lineId) }
        .map { lineRepository.update( /* need receipt here */, it, updatedLine) }
        .map { ResponseEntity(it, HttpStatus.OK ) }
        .orElse { ResponseEntity(HttpStatus.NOT_FOUND) }
    a
    m
    g
    • 4
    • 6
  • k

    kevinherron

    04/18/2018, 8:34 PM
    In Kotlin, if I’m using
    by
    to delegate the implementation of a Java 8 interface containing default methods to something, does anybody know if methods with default implementations on the interface are supposed to be delegated or not?
    d
    • 2
    • 2
  • s

    Shawn

    04/18/2018, 9:49 PM
    Fortran
    that’s a name I haven’t heard in a long while 🚬
    g
    c
    • 3
    • 4
  • j

    Joel Armstrong

    04/19/2018, 2:08 AM
    Anyone have a recommendation for what I should do for logging? I looked at kotlin-logging but I couldn't figure out how to log to a file / do configuration, etc?
    a
    n
    • 3
    • 4
  • s

    suhas

    04/19/2018, 3:42 AM
    pretty good library
    g
    • 2
    • 1
  • s

    Smit Aen

    04/19/2018, 8:33 AM
    I want to learn kotlin from android, I don't know from where to start. I know kotlin official site is there, but except that please help me the website or YouTube videos which I can follow to learn kotlin
    g
    • 2
    • 1
  • a

    andyb

    04/19/2018, 8:40 AM
    @Smit Aen https://developer.android.com/kotlin/get-started.html Can also recommend https://www.amazon.co.uk/Kotlin-Android-Developers-Learn-developing/dp/1530075610 & I think that the author @antonioleiva also runs an online course
    a
    • 2
    • 2
  • j

    Jay

    04/19/2018, 11:33 AM
    Hey guys I’m stuck with a kotlin generics problem: How to inherit from same generic interface twice with two different types?
    interface A<T> {}
    
    class B: A<Apple> {}
    
    class MyClass: B, A<Orange> {}
    Kotlin gave me an error: Type parameter T of ‘A’ has inconsistent values: Apple, Orange
    d
    h
    +3
    • 6
    • 7
  • d

    diesieben07

    04/19/2018, 2:14 PM
    The compiler probably "knows" that
    is Nothing
    is always
    false
    .
    :yes: 3
    c
    • 2
    • 1
  • d

    dsavvinov

    04/19/2018, 4:32 PM
    Let us move to thread, as this seems to cause quite a lot of clutter in global channel.
    a
    p
    • 3
    • 13
  • t

    thatadamedwards

    04/19/2018, 5:53 PM
    yeah - I think that might be the reason
    val date = LocalDate()
    
    date.dayOfMonth = 4 // this does not compile because dayOfMonth only has a getter, and no setter
    g
    • 2
    • 1
  • j

    jw

    04/19/2018, 8:07 PM
    you could write an extension like
    operator fun <K1, K2, V> Map<Pair<K1, K2>, V>.get(key1: K1, key2: K2) = get(key1 to key2)
    , etc.
    😮 2
    f
    • 2
    • 1
  • j

    jw

    04/19/2018, 8:20 PM
    you can get pretty far just wrapping a
    Map
    f
    • 2
    • 1
  • y

    ylemoigne

    04/19/2018, 8:53 PM
    I have an issue with kotlin 1.2.40. Just upgraded ugraded the version in gradle, upgraded the plugin in idea, and except on full rebuild, I have :
    Error:Module 'foo' production: java.lang.Exception: LOGGING: Loading modules: [<http://java.se|java.se>, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web, jdk.accessibility, jdk.attach, jdk.compiler, jdk.dynalink, jdk.httpserver, jdk.incubator.httpclient, jdk.jartool, jdk.javadoc, jdk.jconsole, jdk.jdi, jdk.jfr, jdk.jshell, jdk.jsobject, jdk.management, jdk.management.cmm, jdk.management.jfr, jdk.management.resource, <http://jdk.net|jdk.net>, jdk.packager, jdk.packager.services, jdk.scripting.nashorn, jdk.sctp, jdk.security.auth, jdk.security.jgss, jdk.unsupported, jdk.xml.dom, oracle.desktop, <http://oracle.net|oracle.net>, java.base, java.compiler, java.datatransfer, java.desktop, java.xml, java.instrument, java.logging, java.management, java.management.rmi, java.rmi, java.naming, java.prefs, java.scripting, java.security.jgss, java.security.sasl, java.sql, java.sql.rowset, java.xml.crypto, jdk.internal.jvmstat, jdk.management.agent, jdk.jdwp.agent, jdk.internal.ed, jdk.internal.le, jdk.internal.opt, jdk.jlink] (no MessageCollector configured)
    a
    • 2
    • 5
Powered by Linen
Title
y

ylemoigne

04/19/2018, 8:53 PM
I have an issue with kotlin 1.2.40. Just upgraded ugraded the version in gradle, upgraded the plugin in idea, and except on full rebuild, I have :
Error:Module 'foo' production: java.lang.Exception: LOGGING: Loading modules: [<http://java.se|java.se>, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web, jdk.accessibility, jdk.attach, jdk.compiler, jdk.dynalink, jdk.httpserver, jdk.incubator.httpclient, jdk.jartool, jdk.javadoc, jdk.jconsole, jdk.jdi, jdk.jfr, jdk.jshell, jdk.jsobject, jdk.management, jdk.management.cmm, jdk.management.jfr, jdk.management.resource, <http://jdk.net|jdk.net>, jdk.packager, jdk.packager.services, jdk.scripting.nashorn, jdk.sctp, jdk.security.auth, jdk.security.jgss, jdk.unsupported, jdk.xml.dom, oracle.desktop, <http://oracle.net|oracle.net>, java.base, java.compiler, java.datatransfer, java.desktop, java.xml, java.instrument, java.logging, java.management, java.management.rmi, java.rmi, java.naming, java.prefs, java.scripting, java.security.jgss, java.security.sasl, java.sql, java.sql.rowset, java.xml.crypto, jdk.internal.jvmstat, jdk.management.agent, jdk.jdwp.agent, jdk.internal.ed, jdk.internal.le, jdk.internal.opt, jdk.jlink] (no MessageCollector configured)
a

Andreas Sinz

04/19/2018, 8:54 PM
does both gradle and intellij produce this result?
y

ylemoigne

04/19/2018, 8:56 PM
I'm checking with gradle
Seems to be tied to idea
a

Andreas Sinz

04/19/2018, 9:01 PM
alright, then ask in #intellij and create a yt-ticket
y

ylemoigne

04/19/2018, 9:02 PM
ok thanks
View count: 1