forked from JetBrains/kotlin-web-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc(docs.topics.jvm.javaToKotlinInterop): add notes and examples
- Loading branch information
alfredo-toledano
committed
Aug 27, 2024
1 parent
3c914c4
commit ad0e314
Showing
5 changed files
with
49 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// 1. @JvmStatic | companion object's function | ||
class C { | ||
companion object { | ||
@JvmStatic fun callStatic() {} | ||
fun callNonStatic() {} // THIS one is NOT marked with @JvmStatic | ||
} | ||
} | ||
|
||
// 2. @JvmStatic | named object's function | ||
object Obj { | ||
@JvmStatic fun callStatic() {} | ||
fun callNonStatic() {} // THIS one is NOT marked with @JvmStatic | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
docs/topics/jvm/java-to-kotlin-interop/packageLevelFunctions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.example | ||
|
||
class Util | ||
|
||
// package-level function | ||
fun getTime() { | ||
println("getTime()") | ||
} |