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

    ross_a

    10/10/2017, 10:11 AM
    Actually, I'll move this question to #intellij
    k
    k
    • 3
    • 5
  • b

    brucehan

    10/10/2017, 11:57 AM
    Hi, Is there any good tutorial out there that teach the entire process of how to configure the support of kotlin-dsl in gradle.
    k
    • 2
    • 6
  • b

    brucehan

    10/10/2017, 2:25 PM
    My intellij v2017.2.5 community edition does not recognize kotlin DSL syntax in the build.gradle.kts. Anyone know who to configure the editor to recognize the kotlin DSL syntax?
    k
    • 2
    • 3
  • w

    waicool20

    10/10/2017, 2:59 PM
    Anyone here have an idea why I can't use an extension function after I've exported my APIs to a jar file, trying to use the jar in another project and I cant get it resolved despite the .class file that contains the extension function existing
    k
    • 2
    • 4
  • b

    bdawg.io

    10/10/2017, 6:28 PM
    How does
    internal
    translate in the JVM? Is Kotlin able to provide instructions so it’s distributed JAR includes the same restrictions?
    k
    • 2
    • 1
  • j

    jtonic

    10/11/2017, 5:15 AM
    Hi everyone, Is it possible (and if yes what is the best approach) of having classes with both package level visibility members and public members without internal and a new module?
    public class Foo {
    public void foo1() {}
    void foo2() {}
    }
    public class Fee {
    public void fee1() {}
    void fee2() {}
    }
    🤔 1
    g
    k
    • 3
    • 9
  • f

    Fré Dumazy

    10/11/2017, 2:06 PM
    I don't need it, but I'm using this to maintain compatibility with the previous utils, written in java (method was dpToPx then)
    g
    k
    • 3
    • 10
  • a

    ayubi

    10/11/2017, 2:08 PM
    Hello, I am confused between kotson, klaxon, Gson, Jackson with Kotlin module for parsing JSON in Kotlin. Is there any recommendation/standard, usability issues. Asking for a new project. Where my JSON string might have missing data and I want to use immutable data classes. Anything I should consider before going with any one of those? Any comparisons? Performance issues? Any help would be appreciated. This looks like the right forum to ask.
    k
    • 2
    • 1
  • m

    megamiun

    10/11/2017, 4:49 PM
    I was thinking about something of Kotlin's inner workings, but reached a question: Shouldn't a Delegate follow the changes in the variable that defines how he delegates to? It seems that a Delegate Class always forwards to the same instance that it was created with. But it opens a possible misunderstanding: If I declare the delegated instance in the constructor as a var, shouldn't it change behaviour when the var changes? Or shouldn't a delegated instance always be a val, so it can't be changed? I think I prefer the first, as it would give the user more choice. Anyway, I did a Gist to exemplify the problem: https://gist.github.com/Megamiun/778234b1bb7c9bf3e9fceb6f25264ecd
    k
    a
    • 3
    • 7
  • j

    jlleitschuh

    10/12/2017, 1:01 AM
    This is a general wince why question, but has anyone been able to get IntelliJ to use the aspectj class weaver to weave kotlin bytecode? I have a gradle plugin that I'm working on that does it there. But various IntelliJ configurations I'm using don't seem to be weaving the kotlin class files. Here's the sample project incase anyone is feeling really generous with their time: https://github.com/JLLeitschuh/gradle-kotlin-aspectj-weaver
    d
    j
    f
    • 4
    • 9
  • j

    joejungmann

    10/12/2017, 4:14 PM
    I have a name clash for a few different classes. Is it possible to rename it globally instead of needing to put
    import foo.Bar as bBar
    in all my files?
    k
    r
    • 3
    • 4
  • c

    chris_b

    10/12/2017, 11:08 PM
    I am writing a paper for my language design course at uni, I was wondering if anyone had an opinion on Kotlin's best features
    n
    • 2
    • 1
  • p

    pavel

    10/12/2017, 11:25 PM
    * Runs on JVM * Good Java Interoperability * Data classes * Null Safety * Smart cast
    s
    h
    c
    • 4
    • 13
  • a

    Andreas Sinz

    10/13/2017, 10:12 AM
    @robstoll what are you trying to achieve?
    r
    • 2
    • 4
  • a

    achim

    10/13/2017, 10:17 AM
    hi! I was using back-ticked method names with spaces in unit test when I came across a compiler crash (both for 1.1.51 and 1.2.0-beta-31). here’s a small example triggering it:
    interface `I I` {}
    val a = object : `I I` {}
    result:
    exception: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate property a
    Cause: Invalid class name (must be a fully qualified class name in internal form): Line_0$I I
    File being compiled and position: (1,1) in /Line_1.kts
    PsiElement: val a = object : `I I` {}
    …
    is this a known issue?
    i
    • 2
    • 1
  • a

    aaverin

    10/13/2017, 11:59 AM
    Is there some way to profile kapt in gradle? I would like to see which annotation processors take the most of the time to run
    r
    k
    • 3
    • 3
  • j

    jcomo

    10/13/2017, 5:31 PM
    you could do it in java this way for reference
    public @interface SqlEmbedded {
        public Class<? extends ResultSetMapper> using()
            default NullResultSetMapper.class;
    }
    r
    • 2
    • 1
  • m

    mortda-m

    10/14/2017, 4:27 PM
    what is best practices for data model builder??
    k
    • 2
    • 3
  • j

    jkbbwr

    10/14/2017, 5:13 PM
    Anyone got a cheap trick to access the top or bottom bytes of a short
    k
    • 2
    • 10
  • j

    jkbbwr

    10/14/2017, 5:40 PM
    Why is there no unisgned short in kotlin
    k
    g
    • 3
    • 5
  • j

    jtonic

    10/15/2017, 10:00 AM
    Hi, Another useful kotlin support is the property delegation. Look at by lazy. Kotlin provides out of the box nonNull, lazy, observables. Take a look at kotlin.properties.Delegates. Moreover I saw recently in the kotlin dsl for gradle: by extras and by tasks. Delegation and property delegation it’s one of kotlin main features IMHO. Kind regards Antonel
    k
    • 2
    • 3
  • d

    dla

    10/15/2017, 5:54 PM
    just going through the katas(currently at Collections/Sums[https://try.kotlinlang.org/#/Kotlin%20Koans/Collections/Sum/Task.kt]. i feel like 'sumByDouble{ it.someDoubleType}' is somewhat out of place. Why not just leave it at 'sum{ it.someDoubleType}' ?
    i
    n
    • 3
    • 4
  • d

    dla

    10/15/2017, 6:09 PM
    was using parentheses
    ()
    for higher order functions(
    map
    & co.) discussed over the eventual use of braces
    {}
    ? seems like there could have been a nice opportunity to be less java-ey
    k
    • 2
    • 4
  • i

    ilya.gorbunov

    10/15/2017, 7:36 PM
    @dave08 There's no one-liner for that, but you can implement this operation with the help of `associateBy`:
    fun <F,S,K> setPartition(
    				first: Iterable<F>,
    				second: Iterable<S>,
    				firstGetKey: F.() -> K,
    				secondGetKey: S.() -> K
    		): List<Triple<K, F?, S?>>
    {
        val firstByKey = first.associateBy(firstGetKey)
        val secondByKey = second.associateBy(secondGetKey)
        val allKeys = firstByKey.keys + secondByKey.keys
        return allKeys.map { Triple(it, firstByKey[it], secondByKey[it]) }
    }
    d
    • 2
    • 5
  • n

    Nicholas Bilyk

    10/15/2017, 7:40 PM
    it's Sunday so forgive the laziness, but here's what I thought of
    val a = mapOf("a" to 3)
    	val b = mapOf("a" to 4, "b" to 5)
    
    	val unionKeys = a.keys.union(b.keys)
    	val merged = hashMapOf<String, Pair<Int, Int>>()
    	for (key in unionKeys) {
    		merged[key] = Pair(a[key]!!, b[key]!!)
    	}
    	println(merged)
    d
    • 2
    • 1
  • k

    karelpeeters

    10/15/2017, 7:41 PM
    replace your
    [code]
    with ``` 🙂.
    s
    n
    • 3
    • 3
  • m

    mmaillot

    10/15/2017, 7:56 PM
    Hi, do you know a good ORM framework for Kotlin ?
    k
    c
    +4
    • 7
    • 13
  • k

    Kulwinder Singh

    10/16/2017, 4:58 AM
    Android list of Best open source projects of Intermediate level to study and learn from in , kotlin ?
    k
    r
    r
    • 4
    • 7
  • c

    cotline

    10/16/2017, 9:23 AM
    @stantronic Does IntelliJ work with Android? (Using Android Studio is not an option)
    e
    • 2
    • 1
  • s

    stantronic

    10/16/2017, 9:27 AM
    @khanhbkqt Yes I use kotlin with Mockito - what error do you get?
    k
    • 2
    • 4
Powered by Linen
Title
s

stantronic

10/16/2017, 9:27 AM
@khanhbkqt Yes I use kotlin with Mockito - what error do you get?
k

khanhbkqt

10/16/2017, 9:28 AM
Hi, The implementation of the mocked object was called. Then I got NullPointerException
s

stantronic

10/16/2017, 9:29 AM
Have you followed these instructions to mock final objects? http://hadihariri.com/2016/10/04/Mocking-Kotlin-With-Mockito/
k

khanhbkqt

10/16/2017, 9:29 AM
let me see
thank you
👍 1
View count: 1