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

    Jimmy Alvarez

    01/23/2018, 4:07 PM
    Some ideas how can I solve it
    c
    m
    • 3
    • 4
  • c

    Clayton Walker

    01/23/2018, 7:59 PM
    @SpringBootApplication
    class DemoApplication
    
    fun main(args: Array<String>) {
        runApplication<DemoApplication>(*args)
    }
    👍 2
    c
    • 2
    • 2
  • s

    Shawn

    01/23/2018, 8:01 PM
    sure, I’ll point folks there next time 👍
    c
    • 2
    • 2
  • a

    ansman

    01/23/2018, 10:22 PM
    Not sure if this is the best place for this but I’m having trouble accessing an
    internal
    class from a unit test in the same module. Android Studio shows no issues but when I try to compile I just get
    Cannot access 'XXX': it is internal in 'YYY'
    . This is using Kotlin 1.2.20
    • 1
    • 2
  • j

    jschneider

    01/23/2018, 10:41 PM
    I get a "Type mismatch". It is expecting String instead of String? But can't understand why
    j
    • 2
    • 3
  • a

    afernan

    01/24/2018, 1:02 AM
    Does anyone know how I can get Android studio to run the main function or what the problem is?
    k
    g
    • 3
    • 4
  • z

    ziggy42

    01/24/2018, 1:10 PM
    Is there something builtin to check if a list is sorted?
    a
    • 2
    • 2
  • d

    dh44t

    01/24/2018, 3:18 PM
    unless someone has a better idea
    z
    m
    • 3
    • 9
  • m

    mkodekar

    01/24/2018, 3:23 PM
    Or am i missing something.
    a
    • 2
    • 1
  • m

    menegatti

    01/24/2018, 3:24 PM
    @ziggy42 If I get your code correctly,
    currentTotal
    is always equal to the final
    before
    , right? so
    val list = some.things.map { 
        Something.fromOtherThing(it, currentTotal, currentTotal - it.amount).also {
                currentTotal -= it.amount
        }
    }
    val currentTotal = list.last().thirdParameter
    should work
    z
    • 2
    • 1
  • z

    ziggy42

    01/24/2018, 3:26 PM
    But you have to return right?
    m
    • 2
    • 2
  • z

    ziggy42

    01/24/2018, 3:27 PM
    @dh44t as much as I'd like to learn arrow and fp in general I cannot import a library for just this 😕
    d
    • 2
    • 1
  • r

    raulraja

    01/24/2018, 4:42 PM
    @igor.wojda When a compiler uses two different types as input to a function or class that is parametric and incudes type arguments the compiler needs to infer the intersection type of the different values provided to determine the type of the receiver. In the link above the compiler is trying to determine the inferred type for
    list
    using both
    handlers
    and
    ErrorHandler
    type information and computing the intersection based on the hierarchy of those two applied types. In the first case
    handlers
    uses an interface that declares type arguments in contravariant position
    in
    . The compiler seems to be fine finding the intersection but it's bailing at runtime so the generated bytecode is probably incorrect where it has to do the appropriate cast but this last part is a wild guess.
    👍 2
    i
    • 2
    • 15
  • a

    aidanvii

    01/24/2018, 4:42 PM
    is there a way to disable inline functions in test code? (for coverage since it doesn’t work)
    r
    • 2
    • 2
  • c

    cedric

    01/24/2018, 7:55 PM
    @avolkmann Don’t see how this could affect the performance if you have no value of that type. The use is a bit suspect though, but this practice has been used with some interesting applications under the name “Phantom Type” in Haskell https://wiki.haskell.org/Phantom_type
    👍 1
    a
    r
    • 3
    • 2
  • j

    Joshua F

    01/24/2018, 10:47 PM
    Function1<A, Unit>
    I believe?
    c
    • 2
    • 1
  • k

    kevinmost

    01/24/2018, 10:50 PM
    just changes their ugly
    return Unit.INSTANCE;
    to the slightly less ugly
    return null;
    c
    • 2
    • 2
  • d

    diesieben07

    01/25/2018, 9:31 AM
    The answer is probably "no", but just to be sure: Is there something like Java's
    ServiceLoader
    for pure Kotlin, i.e. can be used in a multiplatform project?
    🇳🇴 4
    g
    • 2
    • 10
  • m

    mike_shysh

    01/25/2018, 1:04 PM
    But May there is a way to avoid creating a class
    c
    g
    • 3
    • 45
  • n

    Nizzle94

    01/25/2018, 2:48 PM
    Can anyone know rxkotlin or rxjava channels in slack ?
    g
    • 2
    • 1
  • n

    nickk

    01/25/2018, 3:18 PM
    Is there an easy way to convert a
    Range
    to an array? There is no
    reduce
    function for Ranges, and although this works, it feels a bit awkward:
    (0..frames).forEach { i -> duration += animation?.getDuration(i)!! }
    i
    • 2
    • 1
  • m

    menegatti

    01/25/2018, 3:21 PM
    maybe
    val frameDurationArray = IntArray(frames + 1) { animation?.getDuration(it)!! }
    val duration = frameDurationArray.sum()
    n
    d
    • 3
    • 3
  • z

    zmarkan

    01/25/2018, 4:50 PM
    Hi everyone 👋 I’ve just launched a survey on the State of Kotlin. I’d like to learn how developers around the world are adopting Kotlin, as well as when you started using it, and what resources helped you learn it. https://pusher-platform.typeform.com/to/o5r0C7 My hope is that the results will help us convince more people in our teams and companies to get on board the Kotlin 🚂 and get the ball rolling! 💪 Oh, and the best part is that by doing the survey you get a chance to win a trip to the KotlinConf in Amsterdam 🇳🇱 ! (✈️ + 🏨 + 🎟️ ). So if you find this interesting please take part and share with your friends and colleagues! We’ll make sure to send you a copy of the results when the report is out. Feel free to ping me for more info!
    🔝 1
    🇮🇪 2
    ✅ 2
    👍 6
    j
    k
    • 3
    • 13
  • c

    cedric

    01/25/2018, 7:01 PM
    @ghosalmartin I once proposed something along those lines: https://discuss.kotlinlang.org/t/extension-types-for-kotlin/1390 . There is a KEEP in progress to add actual type classes to Kotlin (which is in effect what you’re asking): https://github.com/Kotlin/KEEP/pull/87
    g
    • 2
    • 1
  • c

    Czar

    01/25/2018, 7:41 PM
    Is there any benefit to having constants in a companion object instead of just using `private val`s in a singleton? Or even `public val`s for that matter
    s
    • 2
    • 2
  • o

    Olekss

    01/26/2018, 8:23 AM
    I know, but still - if I have 3 net connections downloading stuff and stuffing it into one data structure, I can't do much around it... I am still stuck with synchronization BS, or copy problems etc. Ok not your problem anyway 🙂
    g
    l
    • 3
    • 7
  • o

    Olekss

    01/26/2018, 10:27 AM
    General question. What is good lightweight messaging queue implementation on Kotlin/Java? Should I just go with ActiveMQ and be done with it, or is there something more lightwheight, more smiple... I don't require exactly JMS standard, but reliability would be higher priority. Including possibility to swing binary data (like .class) through it.
    c
    r
    • 3
    • 4
  • r

    rrader

    01/26/2018, 1:06 PM
    https://github.com/JetBrains/kotlin-netbeans/issues/122#issuecomment-359820520 Does Kotlin not compatible with Java? Why can't develop plugin for Netbeans in Kotlin?
    a
    • 2
    • 1
  • o

    Olekss

    01/26/2018, 1:41 PM
    kotlin serialization library which came with 1.2 -> Why it can't serialize plain maps/lists? Or what I miss? I want to have fat map and do serialization of it back and forth... and map type is <String, Any> so Any would be backed by my @Serializable annotation
    e
    s
    • 3
    • 11
  • a

    arekolek

    01/26/2018, 5:21 PM
    it works for me if I add
    operator
    before the
    fun
    👍 1
    d
    • 2
    • 1
Powered by Linen
Title
a

arekolek

01/26/2018, 5:21 PM
it works for me if I add
operator
before the
fun
👍 1
d

dmulligan

01/26/2018, 5:42 PM
Thanks, that is what I was missing.
View count: 1