File tree Expand file tree Collapse file tree 2 files changed +14
-50
lines changed
suspend-transform-plugin-sample
src/main/kotlin/love/forte/plugin/suspendtrans/sample Expand file tree Collapse file tree 2 files changed +14
-50
lines changed Original file line number Diff line number Diff line change
1
+ import love.forte.plugin.suspendtrans.gradle.SuspendTransformGradleExtension
2
+
1
3
plugins {
2
4
`java- library`
3
5
kotlin(" jvm" )
@@ -13,7 +15,7 @@ plugins {
13
15
}
14
16
dependencies {
15
17
// 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 " )
17
19
}
18
20
}
19
21
@@ -39,4 +41,7 @@ dependencies {
39
41
api(" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0" )
40
42
}
41
43
42
-
44
+ extensions.getByType<SuspendTransformGradleExtension >().apply {
45
+ println (this )
46
+ this .useJvmDefault()
47
+ }
Original file line number Diff line number Diff line change 1
1
package love.forte.plugin.suspendtrans.sample
2
2
3
+ import kotlinx.coroutines.CoroutineScope
3
4
import kotlinx.coroutines.delay
4
5
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
6
8
7
9
8
10
/* *
9
11
*
10
12
* @author ForteScarlet
11
13
*/
12
- class ForteScarlet : Scarlet {
13
- @JvmBlocking
14
+ class ForteScarlet : CoroutineScope {
15
+ override val coroutineContext: CoroutineContext
16
+ get() = EmptyCoroutineContext
17
+
14
18
@JvmAsync
15
19
suspend fun stringToInt (value : String ): Int {
16
20
delay(5 )
17
21
return value.toInt()
18
22
}
19
23
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
- }
44
24
}
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
- }
You can’t perform that action at this time.
0 commit comments