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
server
  • m

    Mr.NiceGuy

    11/15/2021, 9:32 AM
    Hi, I am using Ktor websocket server with Netty engine, is there a way to not send data in the ping/pong frames? By default its sending garbage as payload
    p
    h
    • 3
    • 5
  • h

    Håkon Holmstedt

    11/16/2021, 12:34 PM
    Hi! My team is starting to hurt from long (test)compile times and we are wondering if inheritance could be the culprit. We have an
    AbstractBaseTest
    class of about 2000 lines that is inherited by many of our tests, and we have read somewhere on the jetbrains blog that large classes can impact compile time. Is it reasonable to think that rewriting the AbstractBaseClass to something concrete that tests can use, rather than inherit, would improve our situation?
    p
    t
    +3
    • 6
    • 15
  • v

    Vahalaru

    11/19/2021, 2:50 AM
    Hey everyone, either I understand less than I think I do or I'm over complicating the issue but... is it possible, and if so how would I implement, to set up ktor or http4k to make endpoints on my hosted webserver from hostinger to serve responses. Currently I am using php to do so but would like to covid out a way to utilize kotlin. I know I could do so with a VPS server but want to accomplish it on a hosted webserver.
    b
    • 2
    • 2
  • m

    Marcus Brito

    11/19/2021, 1:59 PM
    🧵 hey guys, I’m facing an issue with Kotlin type system and generic class types. In particular, I’m working with Akka Typed and its
    ReceiveBuilder#onMessage
    signature.
    e
    • 2
    • 18
  • h

    Henrik Johansson

    11/22/2021, 3:04 PM
    Is there any "typed" type aliasing? Like regular https://kotlinlang.org/docs/type-aliases.html but that actually create new types but can be interchangeably assigned to from their underlying type?
    r
    e
    j
    • 4
    • 21
  • s

    simon.vergauwen

    11/22/2021, 7:15 PM
    Hey everyone, I was playing with Kafka, and looking around I didn’t really find any extension on top of the Kafka SDK for example to write
    Flow
    based Kafka programs. Was wondering if there would be any interest in such a library, and/or if people are interested in contributing. Or if there is an existing library already out there. I have some operators, and examples ready if someone is interested. https://github.com/nomisRev/kotlin-kafka
    j
    h
    j
    • 4
    • 7
  • m

    Muhammad Abdullah

    11/24/2021, 7:03 AM
    Hi All, I am using springboot and spring-data-jpa to create a rest-api that handles crud operations. I am using Postgresql as the DB. I can get it to work fine, however given the JSON example below I want to store the phoneNumbers, emails, addresses, urls, settings as JSON in the DB column for each one respectively. Is there a known way that this can be done? My data class is fairly simple: I have tried String, Map and Any as the data type for those fields none of which works.
    @Table("organisations")
    data class Organisation(
        @Id val id: UUID?,
        val name: String = "",
        val information: String = "",
        val urls: Any?,
        val emails: Any?,
        val phoneNumbers: Any?,
        val addresses: Any?,
        val settings: Any?,
        val active: Boolean = true,
        val createdAt: Instant = Instant.now(),
        val updatedAt: Instant = Instant.now(),
    )
    { “name”: “Business Name”, “information”: “Business Info”, “phoneNumbers”: { “office”: “+6172345678”, “imam”: “+6142349876” }, “emails”: { “info”: “info@bus.com”, “commity”: “commity@bus.com” }, “addresses”: { “address”: “2345 SomeStreet Road, MyTOWN, 1234", “postal address”: “PO Box 123" }, “urls”: {}, “settings”: { “timeFormat”: “dd/MM/yyyy”, “currency”: “AUD” } } Any pointers or help would be greatly appreciated. Thanks
    t
    ł
    • 3
    • 17
  • s

    Sergey Serdyuk

    12/01/2021, 9:00 PM
    Hi, I got next case with spring boot rest api:
    @RestController
    @RequestMapping("/my_controller")
    class MyController {
    
        @GetMapping(produces = [MediaType.APPLICATION_JSON_VALUE])
        fun getIds(@RequestParam(value = "ids") ids: List<Long>): List<Long> = ids
    }
    when I call for example:
    curl -ik localhost:8080/my_controller?ids=1,2,3
    all good but when my client send an empty value for example:
    curl -ik localhost:8080/my_controller?ids=1,,3
    the list
    ids
    don't check nullability and my method got
    [1,null,3]
    I suppose the problem around conversion from java to kotlin cause when I decompile class to java I see next
    @NotNull
    public List getIds(@RequestParam("ids") @NotNull List ids) {
       Intrinsics.checkNotNullParameter(ids, "ids");
    there is no any nullability checking, any ideas how to fix it, and where is the root of problem? thanks.
    t
    a
    m
    • 4
    • 4
  • s

    Scott Kruse

    12/03/2021, 6:22 PM
    https://aws.amazon.com/about-aws/whats-new/2021/12/aws-sdk-kotlin-developer-preview/ Does anyone know if amazon Aurora is a supported service for the kotlin sdk?
    t
    • 2
    • 2
  • e

    Emanuel Moecklin

    12/10/2021, 6:03 PM
    if you're using Log4j (likely if you do Kotlin server side development) this is highly relevant: https://securityaffairs.co/wordpress/125480/hacking/log4j-java-library-zeroday.html
    l
    i
    +2
    • 5
    • 7
  • a

    alon shoshani.86

    12/12/2021, 11:31 AM
    HI, We are using kotlin with ktor server side. Do kotlin has something similar with feign client? by the way I'm new in kotlin, So any help will be appreciated. https://www.baeldung.com/intro-to-feign
    h
    • 2
    • 1
  • a

    alon shoshani.86

    12/19/2021, 4:05 PM
    HI, We are using kotlin with ktor server side. Is there a way to implement my own annotation to wrap try catch my block code? any examples?
    j
    • 2
    • 1
  • j

    Jairo Andrés Terán Arcos

    12/20/2021, 2:20 PM
    Hi, I need generate swagger api documentation in ktor, you have any example?
    k
    • 2
    • 7
  • g

    Gillian Buijs

    12/21/2021, 10:31 AM
    Good day! 🙂 I am stuck with a dependency problem and hope someone here can help me out. I have a mono repo consisting of 5 modules. Each module is an independent Gradle project (has its own settings.gradle.kts and build.gradle.kts etc) and may or may not have included sub modules. Some of these modules are KMP projects and some or plain Java. Some modules depend on another module in this mono repo, which is always resolved by publishing the artifact to a private repo and pulling it from there. Okay so next I have an example project which uses a module from this mono repo. When I implement a module and sync the project I get this error: """Dependency resolution has ignored the cycle to produce a result. It is recommended to resolve the cycle by upgrading one or more dependencies. Detecting cycle in external variants for : dev.buijs.klutter:annotations-kmp:0.2.12: - app-backend:common:1.0""".... I'm totally baffled because this module (annotations-kmp) literally has zero dependencies. I have by now also removed every single other dep implementation in the example project. I also backtracked every package and artifact name to make sure they are all unique (hence annotations-jvm, annotations-kmp)... Source is here: https://github.com/buijs-dev/klutter
    🙌 1
    • 1
    • 2
  • a

    alon shoshani.86

    12/23/2021, 8:57 AM
    HI, We are using kotlin with ktor server side. Is there a simple way to schedule a task? In spring I just use @scheduler annotation. any examples?
    s
    • 2
    • 8
  • g

    Gillian Buijs

    12/23/2021, 11:16 PM
    Hi, another (simpler) question this time... I just stumbled upon Arrow Meta which looks interesting. I want to make a façade for flutter pigeon. Pigeon only allows a small set of class/service definitions created in dart. I would want to define said service definitions in Kotlin and make a Gradle plugin/task to generate dart classes. Using Arrow Meta, what would be the right way to do this? Just create a low-level converter which maps elements one by one? Or is there a better pattern for this?
    b
    • 2
    • 4
  • a

    alon shoshani.86

    12/27/2021, 7:37 PM
    Hi all, We are using kotlin with ktor server side. and We are using
    io.ktor.client.HttpClient
    To make http calls between microservices and third parties for example: When the http call succeeded the httpResponse maps automatically to my Object, but when there is error in the http call and it failed, I expect the client will throw an exception with the satatus code 40X 50X, and it's not. I need to check manually what is the status code, and decide what to do. Am I using it wrong? Do you have another client to use?
    k
    l
    • 3
    • 7
  • a

    Agustin Magne

    01/01/2022, 5:26 PM
    Hi everyone. Just joined here. I'm using Exposed on a server with Ktor and I need to create a query using the HAVING COUNT(*) = X sql statement, but I don't know how to.. anybody has an idea on how to achieve this?
    d
    • 2
    • 3
  • f

    Fred Bowker

    01/06/2022, 3:26 PM
    Anyone know if there are any plan for Kotlin to support async await as well as coroutines, swift uses async await and C# has had it for a long time, async await is fairly easy to understand and keeps code clean, it would be great if it came to Kotlin so we could use the same paradigm in swift and kotlin
    h
    e
    j
    • 4
    • 10
  • a

    andyg

    01/07/2022, 8:52 AM
    Hi! Do any serverless or function-as-a-service providers currently support JVM 17? As of Jan 2022 AWS Lambda only supports Java 11, same with Azure Functions. Google Cloud Functions (very specific) supports JVM 11.0.6 running on Ubuntu 18.04. Other providers like Netlify, Render.com, Vercel don't support Java at all 😞 Would love to see a service step to 17.
    t
    • 2
    • 2
  • e

    Exerosis

    01/08/2022, 8:02 PM
    This works perfectly fine! However if I change it to this:
    var cancel = false
    var i = 0
    this.forEach {
        val result = !it(using, interaction)
        println("${i++} cancelled = $result")
        if (result) {
            println("cancelling")
            return
        }
    }
    It prints out 4 times DOES NOT print cancelling... and then it just stops.
    e
    • 2
    • 2
  • a

    Alina Grebenkina

    01/13/2022, 12:52 PM
    Hi server-siders! 🧑‍💻🏽 We are looking at some new ways to make the Kotlin experience more convenient for server-side developers, but we need your input! Answer just a few questions for a chance to win a prize 🎁 👇 👇 👇 https://surveys.jetbrains.com/s3/sl-kotlin-developers-survey
    👍 1
    ✅ 9
    v
    m
    d
    • 4
    • 3
  • m

    martmists

    01/14/2022, 11:16 AM
    What is the recommended way to deal with passwords? I see discussions online vary between Bcrypt and PBKDF2, sometimes mentioning Scrypt, and I'm honestly quite overwhelmed with the options available.
    l
    • 2
    • 1
  • j

    Johann Pardanaud

    01/14/2022, 1:25 PM
    Personally, as a user I do not want to authenticate through a third-party and give access to my personal informations. I always use an email/password combo and store everything in a password manager. Also, if one account is hacked, my other accounts are safe. Please, give your users a choice (unless its an enterprise, then some restrictions may apply of course). About your question @martmists, check OWASP's cheatsheet about password storage:
    This cheat sheet provides guidance on the various areas that need to be considered related to storing passwords. In short:
    • Use Argon2id with a minimum configuration of 15 MiB of memory, an iteration count of 2, and 1 degree of parallelism.
    • If Argon2id is not available, use bcrypt with a work factor of 10 or more and with a password limit of 72 bytes.
    • For legacy systems using scrypt, use a minimum CPU/memory cost parameter of (2^16), a minimum block size of 8 (1024 bytes), and a parallelization parameter of 1.
    • If FIPS-140 compliance is required, use PBKDF2 with a work factor of 310,000 or more and set with an internal hash function of HMAC-SHA-256.
    • Consider using a pepper to provide additional defense in depth (though alone, it provides no additional secure characteristics).
    :thread-please: 2
    👍 3
    • 1
    • 1
  • r

    Rob Elliot

    01/18/2022, 2:04 PM
    Does anyone know of a common interface over an Http4K
    HttpHandler
    & the browser fetch API that would allow using the same code to make HTTP requests in the browser and the server?
    c
    p
    • 3
    • 8
  • j

    John O'Reilly

    01/19/2022, 2:51 PM
    Anyone aware if it should be possible to get WebSockets running on an AppEngine setup?
    r
    • 2
    • 2
  • a

    asavio

    01/20/2022, 5:14 AM
    Does anyone know good ways to have a clean shutdown?
    exitProcess()
    terminates the service without waiting for any active processes to complete. Is there a way to wait for all the active process to complete before termination?
    i
    • 2
    • 2
  • g

    Gillian Buijs

    01/20/2022, 6:09 PM
    I have a question regarding kotlinx serialization. I want to have a single superclass which has a function to print an object as JSON. The implementing classes can not have a body. Is there a way to get access to the subclass (or her members) from the superclass? Gist here to make it more clear what I want to do: https://gist.github.com/buijs-dev/f7d197bce7ab44578cf7bc1c568aa6a2 Ofcourse it does work by adding an abstract method to be implemented by the subclass, which returns a reference to said subclass. I however want to avoid having to add a body for this usecase.
    h
    i
    • 3
    • 12
  • g

    Gavin Ray

    01/22/2022, 11:28 PM
    Does anyone happen to know if it's possible to use the
    -DEV
    or
    -SNAPSHOT
    builds via Gradle? I've tried adding the sources in the README here: • https://github.com/JetBrains/kotlin#using--dev-and--snapshot-versions But my build doesn't seem to be able to find the versions
    1.7.0-dev-911
    or
    1.7.255-SNAPSHOT
    e
    • 2
    • 4
  • f

    Fred Bowker

    01/27/2022, 3:41 PM
    Is anyone using SQLDelight for Server (JVM), the instructions on https://cashapp.github.io/sqldelight/jvm_postgresql/ don’t work with a recent version of kotlin gradle 7.3.3
    h
    • 2
    • 6
Powered by Linen
Title
f

Fred Bowker

01/27/2022, 3:41 PM
Is anyone using SQLDelight for Server (JVM), the instructions on https://cashapp.github.io/sqldelight/jvm_postgresql/ don’t work with a recent version of kotlin gradle 7.3.3
h

hfhbd

01/27/2022, 3:54 PM
SqlDelight and Gradle 7.3.3 work without problems for me: Kotlin Gradle DSL
plugins {
    kotlin("jvm") version "1.6.10"
    id("com.squareup.sqldelight") version "1.5.3"
}

repositories {
    mavenCentral()
}

dependencies {
    val sqlDelight = "1.5.3"
    // Apache 2, <https://github.com/cashapp/sqldelight>
    api("com.squareup.sqldelight:coroutines-extensions:$sqlDelight")
    api("com.squareup.sqldelight:jdbc-driver:$sqlDelight")
    // Apache 2, <https://github.com/hfhbd/kotlinx-uuid>
    api("app.softwork:kotlinx-uuid-sqldelight:0.0.12")

    // Apache 2, <https://github.com/Kotlin/kotlinx-datetime>
    api("org.jetbrains.kotlinx:kotlinx-datetime:0.3.2")

    // BSD 2, <https://github.com/pgjdbc/pgjdbc>
    api("org.postgresql:postgresql:42.3.1")
}

sqldelight {
    database("SchemaDB") {
        dialect = "postgresql"
        packageName = "wipma.schema"
        deriveSchemaFromMigrations = true
        verifyMigrations = true
    }
}
f

Fred Bowker

01/27/2022, 3:58 PM
ok cool thanks I’ll give that a go, it looks different from https://cashapp.github.io/sqldelight/jvm_postgresql/
I take it I can remove
buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath("com.squareup.sqldelight:gradle-plugin:1.5.3")
    }
}
h

hfhbd

01/27/2022, 4:00 PM
Yeah, the sample from the docs uses Groovy
f

Fred Bowker

01/27/2022, 4:08 PM
yeah that was what I was just thinking
View count: 8