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

    benleggiero

    03/11/2018, 3:16 PM
    I’m getting this with IDEA 2018.1 EAP, Kotlin 1.2.30

    https://i.imgur.com/0wvUraX.png▾

    l
    • 2
    • 2
  • b

    bod

    03/11/2018, 4:10 PM
    Hello, World! Hey, when doing sealed classes, the compiler complains that the types can only be subtypes of the sealed class. Does that mean that the one example on the official doc is wrong?
    d
    • 2
    • 7
  • b

    benleggiero

    03/11/2018, 5:03 PM
    Why isn’t this legal?
    class Foo<Bar>(
            initial: Bar?
    ) {
        
        private val internal: Any? = initial
        
        fun baz(): Bar? {
            val i = internal
            return if (i is Bar) i
            else null
        }
    }
    Error: Cannot check for instance of erased type: Bar
    d
    • 2
    • 26
  • d

    diesieben07

    03/11/2018, 5:44 PM
    I have two methods:
    fun <T> bind(type: Class<T>, instance: T)
    fun <T> bind(type: Class<T>, factory: Function<T>)
    Calling it like this fails with "Cannot choose among the following candidates without completing type inference":
    bind(MyClass::class.java, { p: String -> MyClass(p) })
    Why is this? Using a reference instead of a lambda (
    bind(MyClass::class.java, ::MyClass)
    ) works fine. What am I missing here?
    a
    • 2
    • 13
  • l

    liz3

    03/11/2018, 11:32 PM
    Hello Im not sure if this is my fault, or a actual bug in the Kotlin Compiler. In the main function, the first thing i am doing is replacing the System.out with a own class(Java). Afterwards i am only invoking thoose methods:
    fun main(args: Array<String>) {
    
        System.setOut(SprummlbotOutStream())
    
        System.out.println("Test System.out.println()")
        println("Test println")
        
    
    }
    Thats the output:
    [12.3.2018 00:26:40 | INFO] Test System.out.println()
    Test println
    
    Process finished with exit code 0
    SprummlbotOutStream
    public class SprummlbotOutStream extends PrintStream {
    
        public SprummlbotOutStream() {
            super(System.out);
        }
    
        @Override
        public void println(String msg) {
            Calendar cal = Calendar.getInstance();
            SimpleDateFormat sdf = new SimpleDateFormat("d.M.Y HH:mm:ss");
            if (!msg.startsWith("["))
                msg = " " + msg;
            super.println("[" + sdf.format(cal.getTime()) + " | INFO]" + msg);
        }
    }
    My question: why does println use the old stream? Kotlin pl: 1.2.30 JDK: 1.8.0_162
    i
    • 2
    • 4
  • g

    gladsonreisgtr

    03/12/2018, 3:56 AM
    https://www.udemy.com/the-complete-kotlin-developer-course-become-a-pro/?couponCode=TCKDC2018
    k
    • 2
    • 1
  • d

    deviant

    03/12/2018, 9:00 AM
    i'm jumping to
    python
    from time to time. and sometimes trying to bring python syntax into kotlin. probably i must be shot for such things anyway 🙂
    m
    a
    • 3
    • 3
  • d

    diesieben07

    03/12/2018, 11:19 AM
    How about this:
    val (a, b, c) = line.split("\t") + listOf(null, null, null)
    d
    • 2
    • 2
  • k

    Kulwinder Singh

    03/12/2018, 12:11 PM
    sometimes I got
    ConcurrentModificationException
    a
    • 2
    • 2
  • k

    Kulwinder Singh

    03/12/2018, 12:15 PM
    so then so how can I change my
    MusicStore
    object to make it safe from errors/race conditions ? do I need to change type of
    lists
    a
    • 2
    • 2
  • t

    tschuchort

    03/12/2018, 1:30 PM
    does anyone know a map class where the
    Entry
    objects stay valid when the backing map is modified? I want to hold on to the
    Entry
    object so I don't have to access the map every time when all I need is that one entry
    k
    • 2
    • 5
  • g

    Gerard de Leeuw

    03/12/2018, 6:26 PM
    I just installed the latest Kotlin 1.2.30 IntelliJ plugin and upgrade my Gradle build files accordingly. Now my IDE is throwing an exception every few seconds and my auto-completion support is gone 😞. Anyone else having this issue? Exception stacktrace incoming
  • l

    logzet

    03/12/2018, 9:10 PM
    Hi, I am trying to compile a multiplatform project (only a common and a jvm module atm) using the Arrow library. IDE completion in Idea worked fine, but compiling fails with "Unresolved reference" errors for the stuff I used from Arrow. Is Arrow compatible with common-modules or is this caused by something else?
    a
    • 2
    • 2
  • r

    Ruckus

    03/12/2018, 10:32 PM
    https://stackoverflow.com/a/501309
    n
    • 2
    • 1
  • d

    diesieben07

    03/12/2018, 10:35 PM
    I could pass a
    Class<T>
    into the exception.
    r
    • 2
    • 12
  • c

    cedric

    03/13/2018, 5:45 AM
    I’m baffled. And the bytecode viewer is not helping because it throws an exception 🙂
    g
    e
    • 3
    • 34
  • n

    neil.armstrong

    03/13/2018, 11:36 AM
    listOf
    will create an immutable list
    /**
     * Returns an immutable list containing only the specified object [element].
     * The returned list is serializable.
     * @sample samples.collections.Collections.Lists.singletonReadOnlyList
     */
    @JvmVersion
    public fun <T> listOf(element: T): List<T> = java.util.Collections.singletonList(element)
    a
    • 2
    • 3
  • a

    Andreas Sinz

    03/13/2018, 11:45 AM
    @nickk you could create your own List-Type and use delegation
    class MyImmutableList<T>(private val list: List<T>): List<T> by list
    then the user won't be able to cast your list into a
    MutableList
    and therefore won't be able to edit it
    a
    • 2
    • 3
  • s

    spand

    03/13/2018, 12:01 PM
    Seems abandoned
    g
    • 2
    • 2
  • k

    Konstantin Petrukhnov

    03/13/2018, 2:56 PM
    What is the good way to make two fields, that are calculated from each other? Here is example that don't work: https://pastebin.com/pTGnX947
    s
    • 2
    • 1
  • a

    anderson.faro

    03/14/2018, 1:10 AM
    Hey guys, realm or objectBox? comments?
    :stackoverflow: 3
    g
    d
    s
    • 4
    • 3
  • p

    pniederw

    03/14/2018, 4:05 AM
    @nkiesel looks like an initialization order problem. probably worth a youtrack issue.
    n
    • 2
    • 1
  • e

    elect

    03/14/2018, 10:28 AM
    I cant
    @JvmName("dotFloat")
    methods in `interface`s?
    d
    s
    • 3
    • 4
  • r

    remen

    03/14/2018, 3:24 PM
    Hey everyone. I'm looking for a concurrent.Semaphore but for coroutines. Does such a thing exist?
    h
    • 2
    • 2
  • d

    deviant

    03/14/2018, 3:32 PM
    is there existing issue for
    collection literals
    feature? can't find it on the tracker
    h
    • 2
    • 5
  • c

    Czar

    03/14/2018, 5:33 PM
    you could do this, but this is ugly as hell: 😈 :java: ❗❗
    data class Person(val name: String, val age: Int) {
    	init {
    		Person::class.memberProperties
    			.find { it.name == "name" }
    			?.javaField
    			?.let {
    				it.isAccessible = true
    				it[this] = "${it[this] as String}suffix"
    				it.isAccessible = false
    			}
    	}
    }
    😆 1
    😱 2
    • 1
    • 2
  • m

    Mahmood Ali

    03/14/2018, 7:11 PM
    How to delete element from array in kotlin ? can u give me simple example ?
    r
    c
    • 3
    • 6
  • s

    Shawn

    03/14/2018, 7:46 PM
    #codereview would be a better place for bikeshedding though 😉
    m
    • 2
    • 1
  • j

    jameskleeh

    03/14/2018, 7:53 PM
    New to Kotlin. Is Spek used as much as Spock is in the Groovy world?
    f
    • 2
    • 2
  • s

    Shenny

    03/14/2018, 10:27 PM
    I do wish that we had a proper alias and nullability for some of the other java.util collections like Queue and Deque
    :youtrack: 1
    e
    • 2
    • 1
Powered by Linen
Title
s

Shenny

03/14/2018, 10:27 PM
I do wish that we had a proper alias and nullability for some of the other java.util collections like Queue and Deque
:youtrack: 1
e

elizarov

03/15/2018, 5:10 AM
#stdlib
View count: 1