Skip to content

Commit c00c148

Browse files
committed
test
1 parent 633fe63 commit c00c148

File tree

2 files changed

+14
-50
lines changed

2 files changed

+14
-50
lines changed

suspend-transform-plugin-sample/build.gradle.kts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import love.forte.plugin.suspendtrans.gradle.SuspendTransformGradleExtension
2+
13
plugins {
24
`java-library`
35
kotlin("jvm")
@@ -13,7 +15,7 @@ plugins {
1315
}
1416
dependencies {
1517
//this.implementation()
16-
classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.3.1")
18+
classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:0.3.2")
1719
}
1820
}
1921

@@ -39,4 +41,7 @@ dependencies {
3941
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0")
4042
}
4143

42-
44+
extensions.getByType<SuspendTransformGradleExtension>().apply {
45+
println(this)
46+
this.useJvmDefault()
47+
}
Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,24 @@
11
package love.forte.plugin.suspendtrans.sample
22

3+
import kotlinx.coroutines.CoroutineScope
34
import kotlinx.coroutines.delay
45
import love.forte.plugin.suspendtrans.annotation.JvmAsync
5-
import love.forte.plugin.suspendtrans.annotation.JvmBlocking
6+
import kotlin.coroutines.CoroutineContext
7+
import kotlin.coroutines.EmptyCoroutineContext
68

79

810
/**
911
*
1012
* @author ForteScarlet
1113
*/
12-
class ForteScarlet : Scarlet {
13-
@JvmBlocking
14+
class ForteScarlet : CoroutineScope {
15+
override val coroutineContext: CoroutineContext
16+
get() = EmptyCoroutineContext
17+
1418
@JvmAsync
1519
suspend fun stringToInt(value: String): Int {
1620
delay(5)
1721
return value.toInt()
1822
}
1923

20-
@JvmBlocking
21-
@JvmAsync
22-
override suspend fun name(): String {
23-
delay(5)
24-
return "ForteScarlet"
25-
}
26-
27-
override suspend fun age(): Long {
28-
delay(5)
29-
return 114514
30-
}
31-
32-
@JvmBlocking
33-
@JvmAsync
34-
override suspend fun self(): ForteScarlet {
35-
delay(5)
36-
return this
37-
}
38-
39-
40-
override suspend fun self2(): ForteScarlet {
41-
delay(5)
42-
return this
43-
}
4424
}
45-
46-
interface Scarlet {
47-
48-
@JvmBlocking
49-
@JvmAsync
50-
suspend fun name(): String
51-
52-
@JvmBlocking(asProperty = true)
53-
@JvmAsync(asProperty = true)
54-
suspend fun age(): Long
55-
56-
@JvmBlocking
57-
@JvmAsync
58-
suspend fun self(): Scarlet
59-
60-
@JvmBlocking(asProperty = true)
61-
@JvmAsync(asProperty = true)
62-
suspend fun self2(): Scarlet
63-
64-
65-
}

0 commit comments

Comments
 (0)