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

    kitttn

    04/16/2017, 10:58 AM
    like
    someList[:]
    in Python
    m
    2 replies · 2 participants
  • j

    joachim.reiss.

    04/16/2017, 12:56 PM
    My approach so far was : 1. Create an equivalent java class (fields declaration should be enough) , 2. Generate equals hashcode , 3. Transform to kotlin file
    b
    2 replies · 2 participants
  • c

    cedric

    04/16/2017, 2:40 PM
    @Paul Woitaschek Helper methods to generate these for you would require reflection, and
    equals()
    and
    hashCode()
    are not methods where you want to do that. Guava has some helper methods, though: https://gist.github.com/rocketraman/1399080/a50ea2206f6ea4bda65ef00d1f54aab6d654d3bd
    👍 2
    p
    5 replies · 2 participants
  • j

    jw

    04/16/2017, 6:59 PM
    @mg6maciej only if you put
    let
    and
    when
    on different lines which there's no reason to do
    m
    1 reply · 2 participants
  • c

    codeslubber

    04/16/2017, 11:18 PM
    only beef after reading through it is claiming coroutines could support actors is a little absurd..
    e
    1 reply · 2 participants
  • g

    groostav

    04/17/2017, 3:45 AM
    Hey gents, I was hoping to replace @cedric's JCommander command-line parser with something a little bit more kotlin friendly. After a couple of weekends I came up with `getoptk`: https://github.com/EmpowerOperations/getoptk. I'm using it on a couple of personal projects but I dont have particularly complex requirements for a command line parser. I would very much appreciate any thoughts or feedback,
    👍 1
    c
    s
    12 replies · 3 participants
  • c

    cedric

    04/17/2017, 3:46 AM
    @groostav
    TBD: link to sonatype/maven central
    Build with Kobalt and upload to JCenter in just two lines in your build file 😄
    🤔 1
    g
    7 replies · 2 participants
  • g

    gbaldeck

    04/17/2017, 2:18 PM
    does anyone know if there is a way to dynamically generate functions or extension functions in Kotlin?
    a
    1 reply · 2 participants
  • a

    amiracam

    04/17/2017, 4:21 PM
    hi all , IDEA question , I can’t seem to have IDEA show Method Separators for Kotlin code ? Is this a known issue ? some way of forcing it ? thanks
    m
    1 reply · 2 participants
  • r

    robstoll

    04/17/2017, 5:22 PM
    Is it possible to define a type with typealias which implements multiple interfaces? something like typalias Person = CanBeNice & CanBeMean
    t
    3 replies · 2 participants
  • i

    Ian

    04/17/2017, 10:37 PM
    Trying to find a better pattern. Have some code like this:
    var s : String? = null
    exec {
        s = createS()
    }
    s!!.doSomething()
    the
    exec
    block is executed synchronously so
    s
    will be assigned to a non-null value, but the type system doesn’t know this hence the
    !!
    .
    createS()
    can only be called within the
    exec
    block. Obviously the
    !!
    is ugly, I’m trying to figure out whether there is a better way to get
    s
    “out” of the inner code block. I could modify
    exec
    such that it will return whatever is returned by the code block, but what if I need to get multiple variables out of the code block?
    u
    3 replies · 2 participants
  • s

    senthilkumarv

    04/18/2017, 11:33 AM
    Hello there. Is there a protobuf generator for Kotlin. I'm currently using the generated Java classes.
    a
    s
    +2
    15 replies · 5 participants
  • o

    orangy

    04/18/2017, 11:33 AM
    I just found something in Haskell 😱 https://github.com/adelnizamutdinov/kotlin-protobuf by @adeln
    s
    a
    2 replies · 3 participants
  • s

    sreich

    04/18/2017, 12:31 PM
    And what, it can then run in something like nodejs?
    s
    2 replies · 2 participants
  • j

    jlleitschuh

    04/18/2017, 2:37 PM
    java.util.function.Function
    has an
    apply
    method. How can I tell the kotlin compiler to call the
    apply
    method and not the extension function?
    i
    1 reply · 2 participants
  • s

    spierce7

    04/18/2017, 3:51 PM
    All our builds have a few warnings "parameter
    blah blah
    is never used." Is there a way to silence that specific Kotlin warning for my entire team? We're using gradle to build.
    m
    m
    +1
    5 replies · 4 participants
  • j

    john.kennedy

    04/18/2017, 4:50 PM
    Hi, I'm trying to convince my manager to start using Kotlin at my company. Does anyone have any up-to-date stats on who's using Kotlin? or lines of code on github? Or anything similar.
    s
    d
    +6
    19 replies · 9 participants
  • m

    mwerschy

    04/18/2017, 9:34 PM
    That a known issue?
    s
    1 reply · 2 participants
  • p

    pcarrier

    04/19/2017, 12:29 AM
    has anybody used Bazel + Kotlin? even first impressions could save me some time 🙂
    r
    i
    2 replies · 3 participants
  • r

    redrield

    04/19/2017, 3:21 AM
    I'd just prefer looking at a block that tells me everything in here is an extension for Int
    k
    1 reply · 2 participants
  • b

    bamdmux

    04/19/2017, 6:03 AM
    I used to have a big extensions file, but I refactored and now I have 3 equally big ones
    😱 1
    m
    1 reply · 2 participants
  • m

    miha-x64

    04/19/2017, 9:08 AM
    Companion is a singleton. Static methods are visible through subclasses, companion objects’ methods are not. Static methods are procedural, companions are object-oriented.
    m
    4 replies · 2 participants
  • m

    mg6maciej

    04/19/2017, 9:36 AM
    I don't like code like this in `RecyclerView`'s
    Adapter
    tho. Prefer to have each case as a class.
    ➕ 1
    p
    l
    9 replies · 3 participants
  • m

    mg6maciej

    04/19/2017, 9:39 AM
    Interesting question. I have a couple of places in my code where I could do that. Let me check on living organism.
    2 replies · 1 participant
  • s

    snowe

    04/19/2017, 5:02 PM
    looks like I'm encountering this. http://stackoverflow.com/questions/35272761/how-to-compare-two-arrays-in-kotlin/35275418#35275418
    i
    1 reply · 2 participants
  • c

    chriswayoub

    04/20/2017, 4:40 AM
    Is there an alternative to delegated properties for observing changes to all properties on a class? Even a hacky reflection-driven way would be fine... Right now, I'm having to add the delegate to every single property and it's easy to miss one (especially in subclasses)
    l
    2 replies · 2 participants
  • i

    ilya.chernikov

    04/20/2017, 9:22 AM
    @kevinrob, yes, there is a kotlin compiler daemon that is used for compilation by default. You can set a system prop
    kotlin.compiler.execution.strategy
    to
    in-process
    to disable it. (The prop should be visible by kotlin gradle plugin, so I guess you can do it via
    GRADLE_OPTS
    env var, but it depends on the gradle execution settings.) But it would be nice to understand the problem first, so could you please first set the prop
    -Dkotlin.daemon.verbose
    and rerun the gradle build with
    --debug
    , and then send us the relevant part of the log/output (that would be last several hundreds lines starting from the failing module compilation). We’ll appreciate that a lot. // cc: @alexey.tsvetkov
    k
    1 reply · 2 participants
  • k

    kevinrob

    04/20/2017, 9:54 AM
    @ilya.chernikov here you are! With this log I think that it is linked to low memory? 😕
    i
    25 replies · 2 participants
  • e

    eviltak

    04/20/2017, 2:32 PM
    This won't be a problem for me, since I'm not going to be using Java at all (why use Java when you have Kotlin), but I'd like to make things​easier for others who may use my library
    m
    1 reply · 2 participants
  • c

    cedric

    04/20/2017, 2:53 PM
    @ilya.chernikov Is that compiler daemon used when I invoke
    kotlinc
    directrly (or
    K2JVMCompiler
    ) or is that daemon only usable from Gradle?
    i
    5 replies · 2 participants
Powered by Linen
Title
c

cedric

04/20/2017, 2:53 PM
@ilya.chernikov Is that compiler daemon used when I invoke
kotlinc
directrly (or
K2JVMCompiler
) or is that daemon only usable from Gradle?
i

ilya.chernikov

04/20/2017, 2:56 PM
No, in these cases no daemon is used. It is usable outside of the gradle (e.g. used from IDEA as well), but the usage is not yet documented. (And in fact API is not yet finished.) Are you asking because you’re interested in using it?
c

cedric

04/20/2017, 2:57 PM
Yup
Kobalt uses incremental compilation and it’s working great, the next step would be to use the daemon
i

ilya.chernikov

04/20/2017, 6:33 PM
I think that around 1.1.3 we should be more or less satisfied with the API. I’ll give you some links as soon as possible.
c

cedric

04/20/2017, 6:33 PM
Great
View count: 2