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

    tianhao

    07/25/2018, 6:02 AM
    Hi, guys below is my code to send a message to Kafka using Java API, for producer value a got a warning like
    accessing non-final property in constructor
    not sure how is the fix for that? Thanks
    class KafkaService {
    
      val producer: KafkaProducer<String, String>
    
      init {
        val props = Properties()
        props[ProducerConfig.BOOTSTRAP_SERVERS_CONFIG] = "127.0.0.1:9092"
        props[ProducerConfig.CLIENT_ID_CONFIG] = "DemoProducer"
        props[ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG] = StringSerializer::class.java.name
        props[ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG] = StringSerializer::class.java.name
    
        producer = KafkaProducer(props)
      }
    
      fun sendToKafka(topic: String, message: String) {
        val producerRecord: ProducerRecord<String?, String> = ProducerRecord(topic, null, message)
        producer.send(producerRecord)
      }
    }
    k
    • 2
    • 1
  • s

    Shahnish

    07/25/2018, 7:28 AM
    Also, Can we create a job-board channel? for opportunities in kotlin.
    g
    • 2
    • 2
  • e

    elect

    07/25/2018, 9:24 AM
    val <K, V>SortedMap<K, V>.first get() =...
    d
    k
    +2
    • 5
    • 8
  • c

    christophsturm

    07/25/2018, 10:19 AM
    if i implement an interface that has a
    getId()
    method, why can’t i use
    override val id
    ?
    n
    • 2
    • 1
  • a

    arekolek

    07/25/2018, 1:16 PM
    I'm not sure, maybe if you extend
    JsonRpcResponse<R>
    with some concrete
    R
    type and pass that class, then it would work(?)
    d
    • 2
    • 1
  • e

    elect

    07/25/2018, 3:28 PM
    something changed and I have no idea what. I was used to read a resource with
    ClassLoader.getSystemResourceAsStream(filename)
    , but now it returns
    null
    .
    Paths.get(".")
    shows it's the right location. What can be wrong? (ps: function is top level)
    • 1
    • 1
  • n

    nwh

    07/25/2018, 3:54 PM
    Is there a way to suppress the warning indicating that a function can be private? I checked the
    DefaultErrorMessages.java
    but didn't see anything there
    :google: 1
    i
    • 2
    • 4
  • r

    rocketraman

    07/25/2018, 7:28 PM
    If I have a
    inline fun <reified T: Any?> foo()
    , where at my call-site
    T
    is a
    List<Something>
    , is there a way to determine
    Something
    inside the inline fun?
    f
    • 2
    • 4
  • s

    stegod10

    07/26/2018, 8:27 AM
    Looking for your suggestion. I just want to draw a path on map and then directive people for that rotate.
    d
    • 2
    • 1
  • a

    ahegazy

    07/26/2018, 9:37 AM
    Should I ever use
    internal
    if my code is not separated into modules?
    k
    • 2
    • 1
  • m

    mp

    07/26/2018, 10:33 AM
    hi there - I often use `if(condition) throw Exception(msg)`(jvm). Are in stdlib functions similar to this
    fun Boolean.throwIfTrue(exception: Exception) { if (this) throw exception }
    fun Boolean.throwIfFalse(exception: Exception) { if (!this) throw exception }
    Don't think that I`m first how think about it 😃 and better use out-of-the-box approach
    s
    • 2
    • 2
  • v

    vpriscan

    07/26/2018, 1:34 PM
    Plugin [id: 'org.jetbrains.kotlin.platform.jvm'] was not found in any of the following sources
    c
    • 2
    • 1
  • d

    dknapp

    07/26/2018, 2:14 PM
    Is there a more idiomatic way to do
    for (i in 0 until someValue)
    ?
    repeat(someValue)
    ?
    o
    k
    • 3
    • 6
  • m

    miha-x64

    07/26/2018, 7:34 PM
    Ideally, we'd like to support functions of arbitrary arity in Kotlin. In practice, a JVM method cannot have more that 255 parameters, so this is the limit for us as well.
    But... vararg... from JVM's point of view is a single argument....
    k
    j
    +2
    • 5
    • 5
  • j

    josephivie

    07/26/2018, 7:38 PM
    I will use
    inline class
    a lot. This is awesome. There are many things that make more sense as an independent class (angles especially), but it seems like a waste of performance to make them that way. No more! With it just as performant, I'm totally using this.
    ➕ 6
    e
    • 2
    • 2
  • k

    karelpeeters

    07/26/2018, 7:47 PM
    Capturing when subject in a variable damm that is awesome!
    👍 8
    f
    j
    e
    • 4
    • 11
  • j

    jw

    07/26/2018, 7:53 PM
    i needed it
    k
    m
    • 3
    • 9
  • g

    gsala

    07/26/2018, 9:19 PM
    Will inline classes be able to have extension functions that work only for the wrapping type?
    g
    • 2
    • 1
  • r

    redrield

    07/27/2018, 1:05 AM
    In theory, could
    inline class
    be used to make a union type
    g
    e
    • 3
    • 19
  • k

    Krs

    07/27/2018, 6:29 AM
    Anyone used Kotlin with SAP Hybris?
    e
    • 2
    • 1
  • e

    elect

    07/27/2018, 8:09 AM
    regarding inline classes (https://github.com/Kotlin/KEEP/blob/master/proposals/inline-classes.md), why
    Name?
    gets mapped to
    String
    instead
    String?
    ..?
    inline class Name(val s: String)
    fun foo(n: Name?) { ... } // `Name?` here is mapped to String
    p
    g
    • 3
    • 3
  • y

    yawkat

    07/27/2018, 9:29 AM
    Is there any issue to using
    @Deprecated(message = "java only", level = DeprecationLevel.HIDDEN)
    to make functions java-only?
    n
    i
    • 3
    • 3
  • s

    Slackbot

    07/27/2018, 11:02 AM
    This message was deleted.
    c
    l
    • 3
    • 2
  • a

    Aregev2

    07/27/2018, 1:14 PM
    Can I launch kotlin REPL from command line?
    👍 1
    w
    • 2
    • 2
  • g

    Grigori

    07/27/2018, 3:11 PM
    I'm looking for academic papers about Kotlin. Does anybody know one?
    k
    v
    +2
    • 5
    • 17
  • r

    rocketraman

    07/27/2018, 9:54 PM
    Crazy compiler bug... this code, with the
    @Suppress
    annotation results in a
    ClassCastException
    , and without it runs without an error:
    fun main(args: Array<String>) {
      fun <T> foo(block: () -> T): T = block()
      @Suppress("ConstantConditionIf")
      if (true) foo { "foo" }
    }
    • 1
    • 1
  • t

    tipsy

    07/28/2018, 1:29 AM
    can anyone think of a more idiomatic (but readable) way of writing this?
    for (entry in map) {
        if (myValue.startsWith(entry.key)) {
            myAction()
            return true
        }
    }
    return false
    👍 1
    c
    k
    • 3
    • 22
  • p

    paulex

    07/28/2018, 2:53 PM
    what is the future of kotlin.... i really want to invest more time in this language.. buh seems like java 8 is a threat
    🤨 6
    👍 1
    k
    s
    +6
    • 9
    • 21
  • g

    gildor

    07/28/2018, 3:34 PM
    Java 8 end of life is near, end of public updates in a couple years and for commercial users in a half year, so Java 8 is not a threat for anyone.
    ☝️ 1
    k
    h
    • 3
    • 4
  • a

    Aregev2

    07/28/2018, 7:50 PM
    Cannot find the native version (which is provided with the K/N compiler itself)
    g
    • 2
    • 1
Powered by Linen
Title
a

Aregev2

07/28/2018, 7:50 PM
Cannot find the native version (which is provided with the K/N compiler itself)
g

gildor

07/29/2018, 1:18 PM
K/N usually merge upstream Kotlin later and released later. But maybe better to ask on #kotlin-native
View count: 1