https://kotlinlang.org logo
Docs
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
  • t

    thana

    06/03/2019, 10:12 AM
    Is there a "clean" way to enforce an exhaustiveness check for
    when(someSealedClass)
    ? I just came across a piece of code where it was very natural to use then
    when
    without any assignment, hence the compiler would never complain when a branch was missing 🤔
    r
    h
    +2
    14 replies · 5 participants
  • m

    Maksim Vlasov

    06/03/2019, 11:53 AM
    What is the recommendation to use/not use "this" in an extention function, because in many cases it could be ommited? I read the Kotlin style guide and didn't find any information about it.
    s
    e
    2 replies · 3 participants
  • r

    RedCross

    06/03/2019, 12:11 PM
    The pattern Singleton in Kotlin is designed by object, so if in java to get an instance of the singleton while we create it : public static SingletonClass getInstance(param1, param2, ...) which will initialize some var "Dynamicly" in the SinletonClass and in the same time create the instance using this params, and as we know there is no constructor in kotlin objects, so how do i pass my params to the object dynamicly ?
    g
    m
    5 replies · 3 participants
  • t

    thana

    06/03/2019, 2:52 PM
    is there a way to disable the warning, that inlining some function will have a negligible impact on the performacne? I'm using it sometimes because i want the code RIGHT THERE or because the function is empty and don't do it for performance
    k
    3 replies · 2 participants
  • u

    U75957

    06/03/2019, 3:14 PM
    I try to use MPP. And I have several JS targets, so my common sourseSet use JS specific code too. But IDEA don't recognise those common source sets as JS-specific. Is there any solution to work in IDEA with such project?
    k
    a
    3 replies · 3 participants
  • s

    Shawn A

    06/03/2019, 3:15 PM
    Kafka has this interface which "gets" a
    Processor<K,V>
    public interface ProcessorSupplier<K, V> {
        Processor<K, V> get();
    }
    Given I have a class:
    class EventNotifier : Processor<String, SomeEvent>`
    I thought I'd be able to call the
    Kstream#process(ProcessorSupplier<? super K, ? super V> var1, String... var2)
    method, but I am getting a type mismatch error for:
    stream.process({ EventNotifier() })
    k
    4 replies · 2 participants
  • o

    orangy

    06/03/2019, 5:05 PM
    Join #wwdc if you’re watching, let’s chat 🙂
    m
    1 reply · 2 participants
  • m

    Marian Schubert

    06/03/2019, 6:53 PM
    Can I make Kotlin recognise that
    java.io.File.listFiles
    returns null sometimes?
    s
    t
    +2
    12 replies · 5 participants
  • s

    sxtanna

    06/04/2019, 2:09 AM
    Is there a reason this doesn't function in this way?
    Result_Type.kt
    s
    s
    7 replies · 3 participants
  • t

    Tuan Kiet

    06/04/2019, 2:21 AM
    why is the
    Result<T>
    shouldn’t be a return type although
    runCatching
    does?
    i
    p
    5 replies · 3 participants
  • s

    Sean Massie

    06/04/2019, 4:34 AM
    Hey is anyone here doing Kotlin contract work?
    p
    2 replies · 2 participants
  • v

    vlad.minaev

    06/04/2019, 5:54 AM
    Does Kotlin have a release schedule ? e.g. what is approx release date of 1.4 ?
    g
    4 replies · 2 participants
  • e

    Eric Obermuhlner

    06/04/2019, 6:30 AM
    Is this a compiler bug or am I missing something?
    abstract class A<T> {
        abstract fun broken(vararg values: T): T
    }
    
    // Error: Class 'B' is not abstract and does not implement abstract base class member public abstract fun broken(vararg values: Int): Int defined in A
    // Error: 'broken' overrides nothing
    class B : A<Int>() {
        override fun broken(vararg values: Int): Int {
            return 5
        }
    }
    The same code works fine if the subclass is with a "normal" object and not a primitive type. Actually the IntelliJ IDE also thinks it should work, at least it generates the code for it but the compiler then complains about it. Tested with kotlin 1.3.31
    :youtrack: 2
    p
    3 replies · 2 participants
  • k

    Kulwinder Singh

    06/04/2019, 8:55 AM
    is kotlinx.serialization works on java classes ?
    🇳🇴 1
    g
    2 replies · 2 participants
  • j

    jaspersmit

    06/04/2019, 9:41 AM
    Can i combine varargs with lambda? It seems its not possible to define a varargs in kotlin, am i missing something for example
    val varArgsFunction = createVarArgsFunction("foo")
    varArgsFunction(1, 2, 3)
    k
    2 replies · 2 participants
  • k

    Kroppeb

    06/04/2019, 10:05 AM
    Can a non-null property have a nullable field?
    t
    g
    +1
    9 replies · 4 participants
  • s

    sulemankhan447

    06/04/2019, 11:26 AM
    Can anyone explain how CursorAdapter is closely coupled to Activity
    k
    r
    3 replies · 3 participants
  • k

    Kroppeb

    06/04/2019, 11:27 AM
    If you are in a function in a supertype and have a variable that is of that type but then smartcasted to a subtype, why do the private functions of the supertype get hidden?
    k
    e
    4 replies · 3 participants
  • r

    ribesg

    06/04/2019, 1:00 PM
    What’s a clean and short Kotlin way to pipe from a BufferedReader into a BufferedWriter?
    k
    1 reply · 2 participants
  • v

    Vague

    06/04/2019, 1:54 PM
    Can anyone recommend beginner-friendly open source Kotlin projects?
    t
    r
    +1
    8 replies · 4 participants
  • p

    Paulius Ruminas

    06/04/2019, 6:29 PM
    Hi, TypeScript uses the same convention to describe constraints for generic types for both classes and functions e.g.
    function foo<T extends Bar>() {}
    and
    class Foo<T extends Bar> {}
    . Just out of curiosity were there any limitations why it couldn't be like
    fun foo<T : Bar>() {}
    in Kotlin?
    🤔 2
    r
    d
    +1
    13 replies · 4 participants
  • t

    thana

    06/04/2019, 7:39 PM
    i have a
    data class
    which has a property of type Array<String> (let's forgo discussing whether or not to use arrays at all). Let's do a step back: What should the
    equals
    method generated for data classes do? I think they should compare the values of data classes. Unfortunately when the
    data class
    has an
    Array
    property compares those arrays using
    equals()
    and not using
    content(Deep)Equals()
    . Do you think this is a good idea? why?
    1 reply · 1 participant
  • j

    jw

    06/04/2019, 7:40 PM
    See the appendix of https://blog.jetbrains.com/kotlin/2015/09/feedback-request-limitations-on-data-classes/
    t
    1 reply · 2 participants
  • f

    fangzhzh

    06/04/2019, 8:47 PM
    hi, do we have a coroutines channel? thank you.
    :yes: 1
    e
    2 replies · 2 participants
  • l

    louiscad

    06/04/2019, 9:00 PM
    @thana I submitted a feature request for allowing to explicitly request use of
    contentEquals
    a while ago: https://youtrack.jetbrains.com/issue/KT-26499 You can add your vote.
    e
    b
    +2
    9 replies · 5 participants
  • m

    mandeep

    06/04/2019, 11:14 PM
    For example: if this directory had these classes:
    class Foo {
       fun bar() {
            println("bar")
       }
    
       internal fun bar2() {
            println("bar2")
       }
    }
    
    internal class Foo2
    It might output something like:
    // public_api.txt
    class Foo {
       fun bar()
    }
    c
    1 reply · 2 participants
  • t

    Tom Adam

    06/05/2019, 8:12 AM
    How many full time devs does JB have on Kotlin?
    m
    t
    4 replies · 3 participants
  • e

    Eric Martori

    06/05/2019, 8:51 AM
    I have a use case that is causing some trouble. We have an interface:
    interface Foo<T> { 
       fun bar(t: T)
     }
    And we want to be able to have the same interface but without the parameter:
    interface Foo {
        fun bar()
    }
    but this is not possible because we are redeclaring the interface name. A possible solution is to declare
    Foo<Unit>
    and pass
    Unit
    instead of having the second interface without parameters, but this verbose on the calling and declaration site. We have an extension function
    fun Foo<Unit>.bar() = bar(Unit)
    to make the calling site clearer, but declaring it is still a little bit cumbersome. Any ideas on how to achieve this?
    m
    w
    +2
    8 replies · 5 participants
  • i

    iex

    06/05/2019, 9:42 AM
    anything convenient to convert a kotlin list to a java list?
    t
    1 reply · 2 participants
  • i

    iex

    06/05/2019, 9:42 AM
    to pass as argument to jdbc for example
    l
    d
    3 replies · 3 participants
Powered by Linen
Title
i

iex

06/05/2019, 9:42 AM
to pass as argument to jdbc for example
l

Lawik

06/05/2019, 10:04 AM
Can you show a code example?
d

Dias

06/05/2019, 10:07 AM
it should work without converting anything
☝️ 1
i

iex

06/05/2019, 10:37 AM
yeah it seems I had something else wrong, it works
View count: 1