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
announcements
  • y

    yole

    06/04/2016, 5:58 PM
    https://github.com/JetBrains/kotlin/blob/master/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt#L107
    q
    • 2
    • 1
  • j

    james

    01/23/2017, 11:03 PM
    I suspect this didn't actually follow the Singleton pattern 100% due to nulling it out - but clearInstance() was more of a way to get rid of the instance entirely, ensuring that a reinitialized fresh instance would be provided next time getInstance() was called
    c
    • 2
    • 4
  • m

    mg6maciej

    01/25/2017, 11:19 AM
    What would be a usecase for a local property with getter/setter?
    h
    • 2
    • 1
  • a

    alexp11223

    01/25/2017, 8:15 PM
    If I have a function like
    fun f(f1: () -> Unit = ::emptyOp, f2: () -> Unit = ::emptyOp)
    and I call it via
    f { }
    does it set the first or the last parameter? I thought the first, but looks like it's the opposite?
    i
    • 2
    • 1
  • r

    rocketraman

    01/25/2017, 8:18 PM
    @okkero Sorry, I got pulled off onto something else... this is the code: https://github.com/rocketraman/logging-log4j-kotlin/blob/master/log4j-api-kotlin/src/main/kotlin/org/apache/logging/log4j/kotlin/Logger.kt#L154
    o
    • 2
    • 9
  • s

    shiraji

    01/26/2017, 8:09 AM
    Does kotlin accept Class Delegation using
    object
    ? The following code compile.
    interface I {
        fun foo()
    }
    
    object O : I {
        override fun foo() {
            println("Foo!!!")
        }
    }
    
    class C : I by O
    
    fun main(args: Array<String>) {
        C().foo() // Foo!!!
    }
    r
    • 2
    • 3
  • m

    mikehearn

    01/26/2017, 11:05 AM
    so i can answer some questions about this if you like
    m
    • 2
    • 20
  • d

    dh44t

    01/26/2017, 11:29 AM
    @mk about your idea of migrating cats to Kotlin, can you take a look at funKTionale? I'm not an expert on cats myself, but I'm interested in any contribution/observation/PR
    • 1
    • 1
  • m

    mk

    01/26/2017, 11:39 AM
    Hi @dh44t ! Sure, I'm aware of the project! I think while there is some overlap, cats has a different focus. I had wanted to chat to you about it though. One area where I think the community could start consolidating is around essentials such as function composition, currying, etc. It would be nice to extract a canonical implementation into a library that these projects share?
    d
    • 2
    • 3
  • d

    dh44t

    01/26/2017, 11:51 AM
    kotlinz???
    • 1
    • 1
  • o

    okkero

    01/26/2017, 2:53 PM
    @hhariri after seeing your entry at TDC in Trondheim about Kotlin, my team is now starting to introduce Kotlin into our backend 🙂
    h
    • 2
    • 1
  • o

    okkero

    01/26/2017, 5:24 PM
    Okay. Thanks. Is there a way to get around this? I don't want to expose my field to Java code. I thought this was a bug.
    i
    • 2
    • 4
  • m

    mbstavola

    01/27/2017, 2:24 AM
    Has anyone encountered this before?
    java.lang.NoSuchMethodError: kotlin.jvm.internal.FunctionReference.<init>(ILjava/lang/Object;)V
    Out of nowhere my code stopped working, invalidate + restart and a clean build didn't fix it, nor did bumping the compiler + std number (was on 1.1 M4, now on 1.1 beta-17).
    i
    • 2
    • 4
  • m

    miha-x64

    01/27/2017, 4:41 PM
    @ralf there’s a
    {@link }
    tag in javadoc
    r
    • 2
    • 5
  • e

    edalorzo

    01/30/2017, 10:28 PM
    Thanks for the information and link Damian. This is interesting. I suppose this means there are no runtime guarantees regarding internal. While I was waiting for someone to comment I wrote a small internal function.
    internal fun hello(name: String): String {
      return "Hello " + name
    }
    compiled it with kotlinc (1.0.6-release-127) and then disassembled it
    public final class DemoKt {
      public static final java.lang.String hello(java.lang.String);
        descriptor: (Ljava/lang/String;)Ljava/lang/String;
        Code:
           0: aload_0
           1: ldc           #9                  // String name
           3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkParameterIsNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
           6: new           #17                 // class java/lang/StringBuilder
           9: dup
          10: invokespecial #21                 // Method java/lang/StringBuilder."<init>":()V
          13: ldc           #23                 // String Hello
          15: invokevirtual #27                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
          18: aload_0
          19: invokevirtual #27                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
          22: invokevirtual #31                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
          25: areturn
    }
    And it looks like it produced just a regular public function.
    c
    • 2
    • 3
  • d

    dirk.dittert

    01/31/2017, 6:46 AM
    A quick question about the release notes for 1.1: do I understand https://blog.jetbrains.com/kotlin/2017/01/kotlin-1-1-beta-is-here/ correctly that support for Java 8 default methods is not in Kotlin 1.1?
    e
    • 2
    • 1
  • e

    elect

    01/31/2017, 11:03 AM
    @abreslav, where is the
    import kotlin.experimental.*
    ?
    e
    • 2
    • 2
  • b

    bamdmux

    02/02/2017, 10:26 AM
    @pawel.barszcz Funktionale has a Try object with very similar functionality, and its flatMap does the try catch automatically
    p
    • 2
    • 2
  • h

    hackerham

    02/02/2017, 11:26 AM
    float "for" cycle would be nice...
    😱 1
    m
    • 2
    • 2
  • s

    sreich

    02/02/2017, 8:51 PM
    Uh... It says map minus returns a copy of the map minus that element... Why...A copy?
    i
    b
    • 3
    • 2
  • n

    nkiesel

    02/03/2017, 2:07 AM
    yes, does the trick. Only missing feature is the "multiple resources in a single try expression" aka
    try (Connection c = getConnection(); ResultSet rs = getRS(c, query) { while (rs.next()) { ... } }
    e
    • 2
    • 2
  • e

    elect

    02/03/2017, 9:38 AM
    what does this error mean?
    i
    • 2
    • 6
  • b

    bombe

    02/04/2017, 4:45 PM
    If I have the type
    Injector.() -> Page
    , how do I specify a literal for that?
    • 1
    • 1
  • g

    groostav

    02/05/2017, 9:30 PM
    how do you mean 'matched'?
    e
    • 2
    • 1
  • p

    Paul Woitaschek

    02/06/2017, 8:24 AM
    Why can java interfer the parameter and why can't kotlin?
    s
    • 2
    • 3
  • x

    xap4o

    02/06/2017, 9:52 AM
    Is there tool for continuous compilation of kotlin-js project? Something like Figwheel or Node. I want to reproduce my usual workng cycle for FE: change code in IDE, switch to browser, reload page, see changes
    b
    • 2
    • 3
  • m

    mikehearn

    02/07/2017, 11:54 AM
    it should be obvious what is meant, no?
    i
    • 2
    • 1
  • o

    orangy

    02/08/2017, 10:25 AM
    So you can update your article to mention
    listOf(1, “2”, 3).filterIsInstance<String>().first()
    which gives you
    String
    value
    👍 1
    d
    b
    • 3
    • 10
  • v

    vach

    02/08/2017, 10:34 AM
    Hi all noticed this little thing and got curious why awesome kotlin team decided to do this consider this kotiln code
    fun enter(key: String) {
    
          if (disabled) {
             return
          }
          // lots of code
    }
    when i decompile kotlin bytecode to see what is the underlying java code i see this
    public final void enter(@NotNull String key) {
          Intrinsics.checkParameterIsNotNull(key, "key");
          if(!disabled) {
              // lots of code moved inside inverted if      
          }
    }
    not a big deal just curious why inverting the if statement? i cant think of some low level performance trick that may be the reason for this
    e
    s
    o
    • 4
    • 13
  • c

    caelum19

    02/08/2017, 11:18 PM
    what would be the best way to have Kotlin 'compiled'(or interpreted, if possible?) on a website? I see https://github.com/JetBrains/kotlin-web-demo uses Tomcat and I would rather not have to compile it for all clients, but I guess it would be fine if nothing else is possible
    b
    • 2
    • 6
Powered by Linen
Title
c

caelum19

02/08/2017, 11:18 PM
what would be the best way to have Kotlin 'compiled'(or interpreted, if possible?) on a website? I see https://github.com/JetBrains/kotlin-web-demo uses Tomcat and I would rather not have to compile it for all clients, but I guess it would be fine if nothing else is possible
b

bashor

02/20/2017, 12:56 PM
caelum19: what exactly do you want to achieve? For example: 1) write your frontend in Kotlin; 2) use kotlin as scripting language;
c

caelum19

02/20/2017, 5:13 PM
@bashor I want to show off my kotlin snippets and be able to run/modify them on the site 🙂
b

bashor

03/06/2017, 6:38 PM
well, probably it’s hard to do anything best than kotlin-web-demo now.
We thinking about running somehow Kotlin JS compiler in the browser, but it’s not simple now
c

caelum19

03/12/2017, 4:59 PM
Ah, I guess that would mean compiling the JS compiler with itself and modifying it not to use non-kotlin libs? Thanks for your response anyway
b

bashor

03/13/2017, 6:29 PM
Ah, I guess that would mean compiling the JS compiler with itself and modifying it not to use non-kotlin libs?
Yes, it’s final solution that we want to have. But for the near future, we can try to convert JVM BC to JS
View count: 3