Join Slack
Powered by
When creating a file with only top-level declarati...
# getting-started
c
CLOVIS
09/11/2021, 10:07 AM
When creating a file with only top-level declarations, I know that there is an annotation so the automatically generated class isn't named “<File name>Kt”, but I can't remember which annotation it is, nor find the good search terms...
e
ephemient
09/11/2021, 10:08 AM
@file:JvmName
ephemient
09/11/2021, 10:08 AM
https://kotlinlang.org/docs/java-to-kotlin-interop.html#package-level-functions
c
CLOVIS
09/11/2021, 10:11 AM
Ah, it must be placed
before
the package declaration. If you place it after the package declaration it says it's not applicable to ‘file:’
e
ephemient
09/11/2021, 10:15 AM
yep, if you place it elsewhere then it applies to whatever follows it, which isn't "file"
c
CLOVIS
09/11/2021, 10:43 AM
Thanks a lot, I was very confused why it didn't accept it.
4
Views
Open in Slack
Previous
Next