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

    nyxcode

    09/05/2017, 9:57 PM
    What If module
    A
    depends on an inline function of module
    B
    ? If both modules are on the classpath as seperate .jars, you'd expect that a change to an inline function in module
    B
    only affects, well, module
    B
    . But thats not the case, because the functions are inlined in module
    A
    . A change to an inline function in module
    B
    would not have any effect because the old version of the function is still inlined in module
    A
    j
    • 2
    • 2
  • j

    jw

    09/05/2017, 10:07 PM
    i've certainly cut myself on inline. I accidentally inlined the use of a lambda which itself was in a non-inline context resulting in about 200 classes a 600 method references to be added to an app
    a
    • 2
    • 1
  • p

    pakoito

    09/05/2017, 11:19 PM
    @orangy what would you say is an unreasonable amount of code after inlining to trigger slow JIT paths
    o
    • 2
    • 3
  • s

    scottc

    09/06/2017, 4:31 AM
    👎 why does intellij complain about "outdated Kotlin runtime" in Gradle. Then provide a "update" button that doesn't work? (And no info on what the user should do instead) "Automatic updates not supported"... I think that is a poor UI choice.
    👍 9
    o
    • 2
    • 1
  • d

    diegog

    09/06/2017, 10:24 AM
    Hi there does anyone know how to get the name of a function inside it?
    k
    l
    +2
    • 5
    • 12
  • a

    alexsullivan114

    09/06/2017, 3:44 PM
    @barrongineer yeah, the elvis operator definitely solves part of the problem, but the thread @jw linked outlines a few more use cases. Sounds like it's normal if/else's or nested let's for now.
    e
    k
    • 3
    • 4
  • e

    ericksli

    09/07/2017, 7:20 AM
    I just found a problem in my code. When I use
    Array<CreditCardType>
    for
    types
    , the first element of the array is null. However, when I use
    List<CreditCardType>
    , it works normally. https://pastebin.com/u1LiT2im
    d
    k
    • 3
    • 11
  • e

    elect

    09/07/2017, 8:02 AM
    forgive this post, but if you would like to have bitwise operatos, please vote this issue: https://youtrack.jetbrains.com/issue/KT-1440
    b
    v
    • 3
    • 15
  • b

    bamdmux

    09/07/2017, 10:45 AM
    And Rust
    e
    v
    • 3
    • 7
  • e

    evanchooly

    09/07/2017, 2:40 PM
    @jw does KotlinPoet handle formatting the output?
    j
    j
    • 3
    • 15
  • a

    adams2

    09/07/2017, 2:47 PM
    where do you guys put constants? I've been putting them standalone at the bottom of the file, since it feels weird to have them above the class javadoc.
    d
    p
    +3
    • 6
    • 7
  • d

    ddsoyka

    09/07/2017, 3:25 PM
    This might be more appropriate as a SO question, but: Given the input
    Jan 1, 2000 12:00 PM
    , and the formats
    MMM d, y h:mm a
    &
    MMM d, y HH:mm
    , my question is: why do both formats match the input using
    SimpleDateFormat
    ?
    k
    • 2
    • 2
  • m

    mmaillot

    09/08/2017, 9:14 AM
    Hello, someone try to compare performance between iteration
    forEach
    and populate
    MutableList
    and recursive function with
    List
    ? The first seems most efficient but the second one respect immutable principle of functional programming.
    k
    e
    • 3
    • 5
  • n

    natpryce

    09/08/2017, 9:56 AM
    Q: has anyone measured how Kotlin type inference affects compile time? Do explicit function result types speed up compilation?
    • 1
    • 1
  • j

    janvladimirmostert

    09/08/2017, 10:37 AM
    Quick question, why is this allowed:
    class A(b: String){
        var b: String
    
        init{
            this.b = b
        }
    }
    but when you add a setter, the property needs to be initialized, otherwise it doesn't compile?
    class A(b: String){
    
        var b: String  // <- b needs to be inialized, otherwise no compile
        set(value) {field = value}
    
        init{
            this.b = b
        }
    }
    d
    n
    +2
    • 5
    • 18
  • m

    mradupoku

    09/08/2017, 10:43 AM
    Hello Team, I am a novice to Android 3.0 Preview 4 and Kotlin programming, after Configuring Kotlin in the project, this is the error i get “Error:(26, 0) Declaring custom ‘clean’ task when using the standard Gradle lifecycle plugins is not allowed.”
    m
    • 2
    • 3
  • e

    edik

    09/08/2017, 2:15 PM
    I think the class idiom (no object/singleton class construct obviously in Java) of a private constructor similar to Java is the standard way... at least how Hadi Hariri recommended in one of his JB Kotlin courses..
    f
    • 2
    • 1
  • e

    edik

    09/08/2017, 2:19 PM
    we need signature aliases 🙂
    r
    • 2
    • 1
  • m

    mike_shysh

    09/08/2017, 2:41 PM
    Does anyone try to use assertJ with kotlin?
    j
    t
    v
    • 4
    • 14
  • d

    diesieben07

    09/08/2017, 4:51 PM
    Are you just looking for named parameters?
    val customer = CustomerInfo(
       param1 = xxx,
       param2 = yyy
    )
    m
    • 2
    • 1
  • l

    louiscad

    09/08/2017, 10:35 PM
    Hi, since Kotlin is type strict, Call<Void> should not work in retrofit2. Will Call<Unit> work?
    d
    g
    • 3
    • 2
  • k

    karelpeeters

    09/10/2017, 10:21 AM
    The bigger issue you're asking about (smart casts for inline functions) is this one: https://youtrack.jetbrains.com/issueMobile/KT-14397 or this one: https://youtrack.jetbrains.com/issueMobile/KT-7186
    d
    • 2
    • 3
  • k

    karelpeeters

    09/10/2017, 2:21 PM
    Does kotlin have a null type? Can I express this in Kotlin?
    fun foo(): null = null
    I can't really think of a use case, I was just wondering.
    d
    • 2
    • 2
  • a

    Artem Ohanjanyan

    09/10/2017, 5:32 PM
    Does anybody know, what was the motivation for not giving access to private members of a nested class?
    g
    • 2
    • 1
  • a

    Artem Ohanjanyan

    09/10/2017, 6:02 PM
    I was confused because I don't have to use inheritance to do that in Java or C++.
    k
    • 2
    • 6
  • d

    diesieben07

    09/10/2017, 10:54 PM
    In Kotlin:
    String
    can never be null,
    String?
    can. In Java
    String
    does not express any notion of whether or not it can be null.
    m
    • 2
    • 4
  • s

    segfalt

    09/10/2017, 10:54 PM
    What is the difference between
    Type!
    and
    Type?
    -- I seem to see a lot of the former when interoping with Java code.
    d
    d
    e
    • 4
    • 3
  • s

    spragg

    09/10/2017, 11:35 PM
    I’ve been searching. Is there a way to determine if a
    lateinit var
    is initialised without using it and catching the exception? or am I going to have to change it to a nullable ?
    k
    r
    d
    • 4
    • 5
  • a

    anan

    09/11/2017, 7:49 AM
    execution failed for task app:kapDebKotlin
    g
    • 2
    • 5
  • m

    mike_shysh

    09/11/2017, 11:02 AM
    It's harder to initialize arrays in kotlin than java=)
    g
    • 2
    • 1
Powered by Linen
Title
m

mike_shysh

09/11/2017, 11:02 AM
It's harder to initialize arrays in kotlin than java=)
g

gildor

09/12/2017, 1:26 AM
It’s because nullability 🙂
View count: 7