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

    Brendan Campbell-hartzell

    05/27/2021, 11:34 PM
    👋 Hi all! 😄 I'm building a program for writers to stay organized and think through their stories. It's a Kotlin desktop application using TornadoFx. While not a paid gig, it's a personal project that I've been working on for years that I would love to have some help finishing. It's an open source project, so you can pick up whatever you'd like to work on. DM me if you or someone you know would be interested and would like to know more! 🙂
    d
    s
    • 3
    • 5
  • n

    Nauman Ashraf

    06/01/2021, 2:55 PM
    Hi everyone. Whats the suitable option for hosting internal private libraries? MavenCentral, Github or JFrog Cloud?
    e
    l
    • 3
    • 6
  • j

    Jason5lee

    06/02/2021, 2:20 PM
    This piece of C# code really offends me.
    😬 4
    s
    • 2
    • 2
  • c

    Colton Idle

    06/02/2021, 11:39 PM
    Does anyone use ben-manes/gradle-version-plugin? Any way to stop it from telling me about dep updates like this? [1.2.0 -> 1.3.0-alpha01]
    l
    o
    • 3
    • 9
  • c

    Colton Idle

    06/05/2021, 4:49 PM
    Anyone know why this regex passes in regex101 when java is selected, but doesn't work in my kotlin app? Just trying to make sure a string has both upper and lower case letters. https://regex101.com/
    (?=.*?[A-Z])(?=(.*[a-z]){1,})
    d
    l
    • 3
    • 6
  • o

    orangy

    06/06/2021, 11:54 AM
    Android
    Sound
    Does anyone know a decent guide for playing sounds on Android from pre-recorded samples, with simultaneous sounds, effects like reverb, loops, tone/pitch variations, attack variations, etc? Kinda like Tone.js. Looking into documentation I’m confused between MediaPlayer, SoundPool, AudioEffects, Oboe and such.
    ➕ 2
    k
    t
    • 3
    • 6
  • s

    Slackbot

    06/07/2021, 9:53 AM
    This message was deleted.
    l
    • 2
    • 1
  • k

    kartikpatodi

    06/13/2021, 2:28 AM
    Hi, I am trying out #compose-desktop and building a basic text editor. I wanted to add auto save functionality to it. Is there any existing library for this? If not, can someone please help me with the approach.
    e
    n
    • 3
    • 15
  • r

    rtsketo

    06/15/2021, 5:53 AM
    In 1.5
    capitalize()
    is deprecated and I'm prompted to replaced it with
    replaceFirstChar { if (it.isLowerCase())
        it.titlecase(Locale.getDefault()) else it.toString() })
    How's that better? I guess I'll re-create the shortcut myself ¯\_(ツ)_/¯
    d
    e
    g
    • 4
    • 4
  • c

    Colton Idle

    06/16/2021, 1:47 AM
    I used to use https://github.com/AdoptOpenJDK/homebrew-openjdk for installing jdk, but recently it seems unmaintained. Getting it to work with m1 macbook has some troubles. What do other people use? Is SDKMAN still the top choice?
    d
    • 2
    • 2
  • s

    Shawn

    06/23/2021, 9:02 PM
    I wrote a pseudo-scope function in Java today to make some old-style construct-and-call-setters POJOs a bit easier to work with, and I’m not sure what to call it. Going by the Scope functions table, the conditions this function fulfills are • Object reference:
    it
    • Return value: Context object • Is extension function: No: takes the context object as an argument. None of the existing names really match how this function is used (though I guess
    also
    is close) and the best name I’ve been able to come up with is
    build()
    , but maybe there’s something better?
    m
    • 2
    • 1
  • h

    Hullaballoonatic

    06/26/2021, 10:05 PM
    What are some of the habits you believe lead to spaghetti code in no time? For me: • mutating the arguments of functions • nested blocks with a depth > 2 • more than 3 arguments to a function • else blocks • classes with more than one job • refusing to refactor • ctrl-c/ctrl-v
    l
    e
    +5
    • 8
    • 8
  • t

    TheOnlyTails

    06/30/2021, 10:37 PM
    Is there some sort of a Kotlin Discord server (official/non-official)? I would prefer to use that considering I never use Slack.
    d
    t
    t
    • 4
    • 4
  • j

    Jason5lee

    07/03/2021, 11:06 AM
    Perfect project name does not exi- github.com/sergeshustoff/dikt
    💥 1
    d
    • 2
    • 1
  • m

    mp

    07/05/2021, 10:07 AM
    hi there Have anyone update gradle from 6 to the 7 version for production projects(jvm, spring)? how it goes?
    :not-kotlin: 2
    t
    m
    • 3
    • 2
  • c

    Colton Idle

    07/06/2021, 11:10 PM
    What's the deal with android and java versions. I don't get why I can use java 11 as my java home and still compile android code if android supports only java 7 (with some of 8)
    l
    j
    g
    • 4
    • 9
  • n

    napperley

    07/15/2021, 1:41 AM
    I have a software development project management type question on where to host a new library that might be developed later on. On GitLab there are some related Kotlin libraries that cover developing native desktop applications (for Linux) that use a GUI, which are under a single organisation called GUI Vista ( https://gitlab.com/gui-vista ). This new library (if developed) would cover 2D graphics using the Cairo library ( https://www.cairographics.org/ ) as a base, however Cairo isn't related to GUI's and unlike the GUI Vista libraries doesn't use the GObject system ( https://en.wikipedia.org/wiki/GObject ) as a foundation. What option should I go for with the new library. Please vote on one of the following options: • 1️⃣ - Make the new library part of the GUI Vista organisation • 2️⃣ - Have the new library in its own organisation • 3️⃣ - Organise the new library some other way (if voting for this option please leave a message)
    1️⃣ 1
    2️⃣ 2
    t
    • 2
    • 2
  • c

    Colton Idle

    07/16/2021, 5:47 PM
    Anyone have these emoji handy somewhere so I can add it to my discord? :kotlinnew: :kotlin-intensifies:
    p
    • 2
    • 1
  • s

    Sami Eljabali

    07/18/2021, 3:39 PM
    Compiled a thorough list of great macOS apps including those I can’t live without: https://sami.eljabali.org/macos-apps/
    l
    • 2
    • 2
  • h

    hho

    07/19/2021, 3:23 PM
    How can I close an issue I opened on YouTrack?
    r
    • 2
    • 1
  • j

    Jason5lee

    07/24/2021, 3:04 PM
    Design question: should the query API validate the argument or just query by the parameter despite whether it is valid?
    t
    • 2
    • 1
  • c

    Colton Idle

    08/05/2021, 4:22 PM
    I need to format a USA phone number, from the typical 10 digits to (123) 343-2345 I have this, but it feels a little cumbersome and not kotlin-y, but maybe it's what I have to do. Any suggestions?
    fun formatPhoneNumber(original: String): String {
        var number = original
        number =
            number.dropLast(4) +
                "-" +
                number.substring(
                    number.length - 4,
                    number.length,
                )
        number =
            number.substring(0, number.length - 8) +
                ")" +
                number.substring(
                    number.length - 8,
                    number.length,
                )
        (number.dropLast(12) +
                "(" +
                number.substring(
                        number.length - 12,
                        number.length,
                )).also { number = it }
        return number
    }
    r
    m
    +2
    • 5
    • 15
  • j

    Jason5lee

    08/08/2021, 2:08 PM
    Why did Kotlin choose value class/inline class to implement
    Result
    instead of normal sealed class and data class inheritance?
    c
    m
    • 3
    • 2
  • y

    Youssef Shoaib [MOD]

    08/10/2021, 8:22 PM
    Call this my ADHD or just me being a total weirdo, but I get a huge flow of happiness whenever IntelliJ has a UI update because Every. Single. Time. it always simplifies the UI and makes it easier to look at and process and it always just becomes better overall. So, thank you a lot to the IntelliJ UI devs for making my week just a little bit happier
    ❤️ 3
    🙂 8
    o
    o
    • 3
    • 2
  • d

    Derek Ellis

    08/12/2021, 3:04 PM
    Found this bizarre behaviour in 1.5.21: https://pl.kotl.in/v-YWrl1uT looks like it's already fixed in 1.5.30, but made me question my sanity when I first ran into it.. Trying to do an equality comparison on a primitive type that comes from a nullable interface is broken, and you can end up in a situation where you try to compare two bytes (in my example code) that have the same value, but the
    ==
    comparison evaluates to
    false
    .
    l
    • 2
    • 1
  • u

    ursus

    08/16/2021, 9:15 PM
    Anyone using Crashlytics, is it normal to not see crashes that cause app to never startup again? i.e. crash on start? Because I messedup sqlite migration, google play console is full of reports, crashlytics doesn't show any. (However google play reports are stupid because they for what ever reason strip exception messages, so its mostly useless)
    l
    • 2
    • 9
  • u

    ursus

    08/19/2021, 11:48 AM
    Does anyone have a clue how is Craslhytics calculating crash-free sessions? Or is this some hyper-dimensional math I'm not aware of How can crashfree be non 100% when 0 crashes
    h
    o
    • 3
    • 8
  • s

    smit01

    08/20/2021, 11:23 AM
    Where can I learn more about event driven programming in kotlin.?😇
    l
    • 2
    • 1
  • d

    Dominaezzz

    08/21/2021, 12:22 PM
    Anyone still find themselves looking for #general ? I've been searching for it for the last few minutes, thought I was finally losing it 😂 .
    😂 1
    r
    a
    • 3
    • 2
  • s

    Shawn

    08/23/2021, 7:52 PM
    is there a hidden intellij middle ground between suppressing a warning for a line and suppressing it for an entire method? I’m in a spot where I want to make it clear that usage of some deprecated methods on more than one line is intentional but don’t really want to apply it to the whole function
    r
    r
    • 3
    • 5
Powered by Linen
Title
s

Shawn

08/23/2021, 7:52 PM
is there a hidden intellij middle ground between suppressing a warning for a line and suppressing it for an entire method? I’m in a spot where I want to make it clear that usage of some deprecated methods on more than one line is intentional but don’t really want to apply it to the whole function
r

rtsketo

08/23/2021, 7:56 PM
@Suppress("deprecation")
above the line of code you want to suppress.
r

Ruckus

08/23/2021, 8:12 PM
What middle ground would there be between line and method?
s

Shawn

08/23/2021, 8:14 PM
Something piggybacking off of editor regions, I suppose—or in this case, being able to suppress it for the body of an if block would be nice, if not especially practical to implement 😅
@rtsketo annotations aren’t allowed in method bodies unless you’re attaching one to a local field declaration, I don’t think
r

Ruckus

08/23/2021, 8:21 PM
If there's a handful of statements you want to suppress, you can wrap them in a run and add
@Suppress("DEPRECATION")
before the run. Nothing within the run will show deprecation warnings. e.g.
deprecatedFunction()  // Warning
@Suppress("DEPRECATION")
run {
    deprecatedFunction()  // No warning
    ...
    anotherDeprecatedFunction()  // No warning
}
anotherDeprecatedFunction()  // Warning
☝️ 1
☝️🏼 1
💯 4
View count: 1