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

    spnda

    05/12/2021, 2:47 PM
    Did I just find a bug with the Kotlin compiler? The following example throws an error at line 4:
    'if' must have both main and 'else' branches if used as an expression
    fun exampleFunc(someBoolean: Boolean) = when (someBoolean) {
        else -> {
            val otherBoolean = Random.nextBoolean()
            if (otherBoolean) {
                print("Yay!")
            }
        }
    }
    It seems to think it is a ternary, I guess.
    k
    a
    +2
    • 5
    • 7
  • c

    Colin Contreary

    05/12/2021, 8:03 PM
    Is there an appropriate channel to share information about a webinar geared towards Android developers? My company, Embrace, allows mobile teams to go from a Google Play Store review directly to inspecting the user session where the issue occurred. We have a webinar showing this feature, and I'd like to share but also do not want to spam if it's inappropriate.
    n
    b
    s
    • 4
    • 4
  • d

    Dany

    05/13/2021, 2:10 AM
    I am new to agile method, if my PM set a feature to be 4 story points, it means that it takes 1 individual to complete it in 4 story points or it takes the whole BE team to complete in 4 story points?
    :not-kotlin: 12
    ☠️ 1
    🤐 1
    p
    • 2
    • 1
  • l

    LastExceed

    05/13/2021, 8:29 AM
    is there a function for
    ?:
    similar to how there's
    get()
    for
    []
    ? if not, why not ?
    b
    c
    e
    • 4
    • 55
  • n

    ninadmg

    05/13/2021, 8:58 AM
    https://kotlinlang.org/docs/shared-mutable-state-and-concurrency.html#volatiles-are-of-no-help It says here that volatiles do not provide atomicity of larger actions like increments. Increments is the smallest action i can think of. Does that mean volatiles has zero value? is this only in the case of coroutines or also in the case of threads?
    d
    c
    e
    • 4
    • 4
  • d

    Danny Zhang

    05/13/2021, 10:00 AM
    Is there any way to force return true here in a debugger?
    b
    r
    • 3
    • 7
  • d

    David Smith

    05/13/2021, 2:26 PM
    I’m pretty stuck on something, getting the following failure on a micronaut test
    Failed to inject value for parameter [client] of class
    I’m trying to inject a client in the constructor of a
    StringSpec
    test
    @Client(value = "/") private val client: RxHttpClient,
    I just can’t work it out.
    • 1
    • 2
  • s

    Slackbot

    05/13/2021, 4:36 PM
    This message was deleted.
    j
    m
    • 3
    • 2
  • e

    elect

    05/14/2021, 5:31 AM
    is it normal that if I want to implement the following gradle interface
    public interface ArtifactRepository {
        String getName();
        void setName(String name);
    I cant use a
    override var name: String
    , but I'm forced to
    class GithubArtifactRepository : ArtifactRepository {
        private var n = "github"
        override fun getName(): String = n
        override fun setName(name: String) { n = name }
    e
    • 2
    • 2
  • k

    kralli

    05/14/2021, 10:39 AM
    Want some fun? Compile the following code and watch your 1.5.0 compiler burn and crash 😄 (already created an issue)
    interface A {
        fun a(): String = bu
            "test ${unresolved}"
        }
    }
    c
    m
    +2
    • 5
    • 32
  • g

    Gilles Barbier

    05/14/2021, 1:08 PM
    Hello, I use this class in my tests:
    interface TaskA
    
    class TaskWithExceptionInInitializerError : Task(), TaskA {
        companion object {
            @JvmStatic
            val e: Nothing = throw Exception("ExceptionInInitializerError")
        }
    }
    Of course this task is written to trigger an Exception during instantiation. I had no issue with Kotlin 1.4.30, but with 1.5.0, it does not compile, with following error:
    org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during code generation
    ...
    Caused by: java.lang.RuntimeException: Exception while generating code for:
    FUN JVM_STATIC_WRAPPER name:getE visibility:public modality:FINAL <> () returnType:kotlin.Nothing
      EXPRESSION_BODY
        BLOCK type=kotlin.Nothing origin=null
          CALL 'public final fun <get-e> (): kotlin.Nothing declared in io.infinitic.config.tasks.TaskWithExceptionInInitializerError.Companion' type=kotlin.Nothing origin=null
            $this: GET_FIELD 'FIELD FIELD_FOR_OBJECT_INSTANCE name:Companion type:io.infinitic.config.tasks.TaskWithExceptionInInitializerError.Companion visibility:public [final,static]' type=io.infinitic.config.tasks.TaskWithExceptionInInitializerError.Companion origin=null
          CALL 'public final fun throwKotlinNothingValueException (): kotlin.Nothing declared in kotlin.jvm.internal.Intrinsics' type=kotlin.Nothing origin=null
    
    	at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:54)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethodNode(ClassCodegen.kt:338)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethod(ClassCodegen.kt:353)
    	at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate(ClassCodegen.kt:128)
    	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.doGenerateFilesInternal(JvmIrCodegenFactory.kt:206)
    	... 35 more
    Caused by: java.lang.AssertionError: IrCall expected inside JvmStatic wrapper:
    FUN JVM_STATIC_WRAPPER name:getE visibility:public modality:FINAL <> () returnType:kotlin.Nothing
      EXPRESSION_BODY
        BLOCK type=kotlin.Nothing origin=null
          CALL 'public final fun <get-e> (): kotlin.Nothing declared in io.infinitic.config.tasks.TaskWithExceptionInInitializerError.Companion' type=kotlin.Nothing origin=null
            $this: GET_FIELD 'FIELD FIELD_FOR_OBJECT_INSTANCE name:Companion type:io.infinitic.config.tasks.TaskWithExceptionInInitializerError.Companion visibility:public [final,static]' type=io.infinitic.config.tasks.TaskWithExceptionInInitializerError.Companion origin=null
          CALL 'public final fun throwKotlinNothingValueException (): kotlin.Nothing declared in kotlin.jvm.internal.Intrinsics' type=kotlin.Nothing origin=null
    
    	at org.jetbrains.kotlin.backend.jvm.codegen.IrCodegenUtilsKt.isAccessorForDeprecatedJvmStaticProperty(irCodegenUtils.kt:364)
    	at org.jetbrains.kotlin.backend.jvm.codegen.IrCodegenUtilsKt.isDeprecatedFunction(irCodegenUtils.kt:348)
    	at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.calculateMethodFlags(FunctionCodegen.kt:184)
    	at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.doGenerate(FunctionCodegen.kt:59)
    	at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:52)
    	... 39 more
    Any idea, how to avoid this?
    j
    r
    a
    • 4
    • 7
  • j

    Jose A.

    05/14/2021, 2:50 PM
    Hi there! Tried Kotlin 1.5.0 today. When running the tests in one particular backend I get this exception:
    java.lang.ClassCastException: class [[Ljava.lang.Object; cannot be cast to class [[Ljava.lang.String; ([[Ljava.lang.Object; and [[Ljava.lang.String; are in module java.base of loader 'bootstrap')
    	at edu.upc.groups.service.adapter.GroupTemplateApi$$serializer.deserialize(GroupApiRestDomainMapping.kt:75)
    	at edu.upc.groups.service.adapter.GroupTemplateApi$$serializer.deserialize(GroupApiRestDomainMapping.kt:75)
    	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    The serializable class is (working perfectly in previous Kotlin version)
    @Serializable
    internal class GroupTemplateApi(
        val id: String,
        val expression: String,
        val attributes: Array<String>,
        val records: Array<Array<String>>,
        val owner: Int,
    )
    What do you thing, I should file a bug? Kotlin? Serialize library? I already tried to clean and reset caches.
    n
    a
    • 3
    • 3
  • y

    Yan Pujante

    05/14/2021, 3:22 PM
    I have a puzzling behavior:
    import kotlin.time.*
    
    class MyClass {
       // ...
        private var _timeSource = TimeSource.Monotonic
      // ...
    }
    results in
    Unresolved reference: TimeSource
    If I use
    private var _timeSource = kotlin.time.TimeSource.Monotonic
    , then it is fine. Any idea?
    e
    • 2
    • 5
  • l

    LastExceed

    05/14/2021, 7:17 PM
    why can't interfaces inherit from classes ?
    e
    r
    i
    • 4
    • 25
  • l

    LastExceed

    05/14/2021, 7:18 PM
    why do interface members have to be public ?
    e
    r
    n
    • 4
    • 8
  • p

    Patrick Ramsey

    05/15/2021, 12:17 AM
    that’s disappointing
    r
    e
    n
    • 4
    • 20
  • c

    Christopher Elías

    05/15/2021, 1:33 AM
    Question: When are flow apis like
    flattenMerge
    going to be "stable"? Whe are now in coroutines 1.5.0 and it still needs to be annotated with @ExperimentalCoroutinesApi
    e
    v
    • 3
    • 3
  • c

    Clay Gillman

    05/15/2021, 5:28 AM
    So the release of Kotlin 1.5 finally unlocks the use of
    Result
    by default! I was surprised to find this out given how quiet this change was. Using
    Result
    as a return type for libraries and in general seems like a great middle ground between the looseness of unchecked exceptions and the verboseness of sealed classes as return types. You can force callers of your method to handle any failure by simply doing
    fun method(): Result<T> = runCatching { ... }
    , allowing uncaught exceptions in the method to bubble up into the failure case of the result. This is much less code than creating a sealed class for every failure case and writing the logic to convert each exception to them. Easier to read and reason about, and doesn't even force you to adopt functional-style-programming. Now that this is doable with vanilla Kotlin, what does everyone think? Would you adopt this as your default way of error handling? How would you feel consuming a library that exclusively used
    Result
    instead of throwing exceptions?
    j
    h
    • 3
    • 5
  • c

    carbaj0

    05/15/2021, 11:40 AM
    is there any way to achieve this behavior without the compilation error?
    Untitled
    d
    • 2
    • 2
  • a

    Ayfri

    05/16/2021, 12:41 AM
    Hi, I have a question, does Kotlin has better performances than Java at execution ?
    a
    n
    +2
    • 5
    • 5
  • g

    Grigorii Yurkov

    05/16/2021, 11:43 AM
    Is there a compiler flag to disable auto generated componentN for data classes?
    :nope: 1
    ➕ 2
    n
    e
    +2
    • 5
    • 24
  • s

    SirNapkin1334

    05/16/2021, 8:19 PM
    Hello, I've been having a very strange problem. Kotlin does not find a field in an anonymous object.
    val man = object : ScriptEngineManager(Thread.currentThread().contextClassLoader) {
    	val engine: ScriptEngine inline get() = getEngineByExtension("kts")!!
    }
    When I try to do
    man.engine
    , it says
    Unresolved reference: engine
    , as if it's not there at all. It's very strange. The weirdest thing, is that if I take that code, and copy-paste it into my function, so that
    man
    is a local variable, it works fine. But if I have it as a field, I cannot access
    engine
    and I don't know why. There are no naming conflicts with the superclass.
    r
    n
    • 3
    • 8
  • g

    Grigorii Yurkov

    05/17/2021, 12:36 PM
    IDEA generates
    equals
    and
    hashCode
    (for class
    A
    ) with violating
    hashcode
    contract. Is it bug, or am I wrong?
    k
    a
    m
    • 4
    • 37
  • n

    nitrog42

    05/17/2021, 2:30 PM
    I remember reading about a way to benchmark our code using Kotlin Duration classes, I can't find it back. I know there is measureTime, measureTimedValue, but it execute in a block and I'm pretty sure there was a way to do it outside of a block, or by calling a method to "mark" moment of time (like start and stop), does anybody know wha I'm talking about ?
    r
    i
    • 3
    • 5
  • g

    glenkpeterson

    05/17/2021, 3:05 PM
    I have a variable called
    dec31_2015
    in Java. How should I name that in Kotlin? I get this warning about the underscore.
    r
    r
    +4
    • 7
    • 8
  • k

    Kirill Grouchnikov

    05/17/2021, 5:19 PM
    Is this new in Coroutines 1.5.0?
    😍 4
    :yes: 4
    😂 2
    e
    n
    +5
    • 8
    • 11
  • s

    Shivansh Mishra

    05/18/2021, 1:49 AM
    Hello everyone, I have been learning kotlin for about a month, I want to contribute to open source libraries so that I can learn kotlin best practices and new things. Can anyone please suggest some good beginner friendly open-source project. P.S. I don't want to work on android apps I want to work on some generic libraries.
    a
    • 2
    • 2
  • s

    Sangmin Lee

    05/18/2021, 5:15 AM
    Hi everyone. I’m from python and I’ve been learning kotlin for about a month as well. As using Kotlin, I’m getting understand the syntax but don’t get how to design well OOP yet. Can anyone please suggest book recommendation or related materials? Thanks!
    s
    m
    • 3
    • 5
  • j

    J6ey

    05/18/2021, 8:13 AM
    Why won't this work? LegalMenu is an enum.
    r
    • 2
    • 8
  • r

    Roy Grini

    05/18/2021, 10:07 AM
    https://www.reddit.com/r/java/comments/ndwz92/can_i_get_some_reasons_to_use_java_instead_of/ 🍿
    i
    l
    t
    • 4
    • 21
Powered by Linen
Title
r

Roy Grini

05/18/2021, 10:07 AM
https://www.reddit.com/r/java/comments/ndwz92/can_i_get_some_reasons_to_use_java_instead_of/ 🍿
i

irus

05/18/2021, 10:12 AM
So many haters in comments 🙂
l

Lazard

05/18/2021, 10:27 AM
I mean, they all have valid points. I don't think Kotlin will just magically vanish or turn into a mess, torn between following Java and having its own style, but it's definitely something to consider
i

irus

05/18/2021, 10:36 AM
Top comment even didn't try to google, I didn't read it fully, but starting from the first point it's wrong 🙂 https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-metadata/
And obviously top commenter didn't know about Kotlin design process and history of patter matching in Kotlin 🙂
Now, both java and kotlin cater to this use case, they cater to it in a different way, and I'm pretty sure that if I could smack a giant reset button and design kotlin all over again and release it today into public beta, then kotlin would have followed in java's shoes. Especially considering that the java version is in many ways far more powerful than kotlins: You can do more than just 'check type' with this syntax (you can also 'deconstruct' value types), you don't NEED a block, as in, this works too:
That happens when people start comparing things they didn't know equally good
r

Roy Grini

05/18/2021, 10:51 AM
@irus I for sure can’t get anything about the metadata spec from the link you provide. It only gives an input of metadata format. Nothing about content
i

irus

05/18/2021, 10:55 AM
Hm, I can map doc to this example from my class
@Metadata(
   mv = {1, 4, 3},
   bv = {1, 0, 3},
   k = 1,
   d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\b\u0010\u000e\u001a\u00020\u000fH\u0016R&\u0010\u0007\u001a\u000e\u0012\u0004\u0012\u00020\t\u0012\u0004\u0012\u00020\t0\bX\u0096\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\n\u0010\u000b\"\u0004\b\f\u0010\rR\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"},
   d2 = {"Llink/kotlin/repo/GithubConfigurationService;", "Llink/kotlin/repo/ConfigurationService;", "httpClient", "Lorg/apache/http/client/HttpClient;", "yamlMapper", "Lcom/fasterxml/jackson/databind/ObjectMapper;", "(Lorg/apache/http/client/HttpClient;Lcom/fasterxml/jackson/databind/ObjectMapper;)V", "configuration", "", "", "getConfiguration", "()Ljava/util/Map;", "setConfiguration", "(Ljava/util/Map;)V", "update", "", "repo.kotlin.link.main"}
)
Idk what I want to get from it, because this is basically info that compiler can't infer from classfile (or it's easier to put as ready-to-use metadata)
r

Roy Grini

05/18/2021, 10:56 AM
Sure, but what does this contain? d1? d2? And why, and for what? How would any other code editor than IntelliJ make use of this?
i

irus

05/18/2021, 10:57 AM
From the doc:
This annotation is present on any class file produced by the Kotlin compiler and is read by the compiler and reflection
It's has nothing with intellij itself
All details on how to use can be found in kotlin repo (compiler is apache 2.0 licensed)
r

Roy Grini

05/18/2021, 10:59 AM
IntelliJ needs this info also in order to provide debugging i guess. But - my main point is your only effort so far is to try and discredit the post, not discuss it.
👎 1
i

irus

05/18/2021, 11:01 AM
IntelliJ needs this info also in order to provide debugging i guess.
Debugging built on top of JDI, and probably can't benefit from @metadata directly
It should be implementation detail, and PSI or IR exposes it's through their interface.
I believe this is content of d1 if you really interested https://github.com/JetBrains/kotlin/blob/master/core/metadata/src/metadata.proto
And I found it even without cloning the project, just browsing repo in github)
JFR and JMC for years was commercial feature of java, but commenter doesn't complain about "proprietary" Oracle)
t

thanksforallthefish

05/18/2021, 12:21 PM
I am definitely not into language details, but I feel like better java could mean better kotlin. java is not only the language, but to some degree also the jvm: afaik kotlin compiler is translating some constructs into equivalent jvm bytecodes, if by developing java those constructs become first class citizens in the jvm, then kotlin compiler will be faster. from a user point of view, you won’t see a new feature, but the feature will work ‘better’. the main problem could be the other way around, but java development is handled through jeps so it is possible kotlin will get inspired by those jeps and implement them the kotlin way before they will find their way in java and then kotlin can iterate by leveraging what java introduced.
surely the closer the 2 languages becomes and should it end up being only a difference in syntax, then there will be some redundancy. kotlin supports multiplatform, or wants to, but I am personally not yet convinced (I am mostly BE, but saw the back and forth between native, then webview, then native again, and to some degree I would pick webviews there, ‘portable’ between different platforms - don’t quote me, never went beyond pet projects outside BE development0
i

irus

05/18/2021, 12:58 PM
Right now majority of kotlin indeed targeting JVM (or ART), but in 5-6 years it can be LLVM and JS more popular than JVM target, who knows 🙂
View count: 2