File tree 7 files changed +60
-3
lines changed
libraries/tools/abi-validation
7 files changed +60
-3
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ kotlin {
109
109
tasks.compileTestKotlin {
110
110
compilerOptions {
111
111
languageVersion.set(KotlinVersion .KOTLIN_1_9 )
112
+ freeCompilerArgs.add(" -Xjvm-default=all-compatibility" )
112
113
}
113
114
}
114
115
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ internal data class MethodBinarySignature(
60
60
super .isEffectivelyPublic(classAccess, classVisibility)
61
61
&& ! isAccessOrAnnotationsMethod()
62
62
&& ! isDummyDefaultConstructor()
63
+ && ! isSuspendImplMethod()
63
64
64
65
override fun findMemberVisibility (classVisibility : ClassVisibility ? ): MemberVisibility ? {
65
66
return super .findMemberVisibility(classVisibility)
@@ -71,6 +72,14 @@ internal data class MethodBinarySignature(
71
72
72
73
private fun isDummyDefaultConstructor () =
73
74
access.isSynthetic && name == " <init>" && desc == " (Lkotlin/jvm/internal/DefaultConstructorMarker;)V"
75
+
76
+ /* *
77
+ * Kotlin compiler emits special `<originalFunctionName>$suspendImpl` methods for open
78
+ * suspendable functions. These synthetic functions could only be invoked from original function,
79
+ * or from a corresponding continuation. They don't constitute class's public ABI, but in some cases
80
+ * they might be declared public (namely, in case of default interface methods).
81
+ */
82
+ private fun isSuspendImplMethod () = access.isSynthetic && name.endsWith(" \$ suspendImpl" )
74
83
}
75
84
76
85
/* *
Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ public class cases/default/ClassFunctions {
7
7
8
8
public abstract interface class cases/default/InterfaceFunctions {
9
9
public abstract fun withAllDefaults (ILjava/lang/String;)V
10
+ public static synthetic fun withAllDefaults$default (Lcases/default/InterfaceFunctions;ILjava/lang/String;ILjava/lang/Object;)V
10
11
public abstract fun withSomeDefaults (ILjava/lang/String;)V
12
+ public static synthetic fun withSomeDefaults$default (Lcases/default/InterfaceFunctions;ILjava/lang/String;ILjava/lang/Object;)V
11
13
}
12
14
13
15
public final class cases/default/InterfaceFunctions$DefaultImpls {
Original file line number Diff line number Diff line change 1
1
public abstract interface class cases/interfaces/BaseWithImpl {
2
- public abstract fun foo ()I
2
+ public fun foo ()I
3
3
}
4
4
5
5
public final class cases/interfaces/BaseWithImpl$DefaultImpls {
6
6
public static fun foo (Lcases/interfaces/BaseWithImpl;)I
7
7
}
8
8
9
9
public abstract interface class cases/interfaces/DerivedWithImpl : cases/interfaces/BaseWithImpl {
10
- public abstract fun foo ()I
10
+ public fun foo ()I
11
11
}
12
12
13
13
public final class cases/interfaces/DerivedWithImpl$DefaultImpls {
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2016-2024 JetBrains s.r.o.
3
+ * Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
4
+ */
5
+
6
+ package cases.suspend
7
+
8
+ public interface I {
9
+ suspend fun openFunction (): Int = 42
10
+ }
11
+
12
+ public interface II : I {
13
+ override suspend fun openFunction (): Int {
14
+ return super .openFunction() + 1
15
+ }
16
+ }
17
+
18
+ public open class C : II {
19
+ override suspend fun openFunction (): Int {
20
+ return super .openFunction() + 2
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ public class cases/suspend/C : cases/suspend/II {
2
+ public fun <init> ()V
3
+ public fun openFunction (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
4
+ }
5
+
6
+ public abstract interface class cases/suspend/I {
7
+ public fun openFunction (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
8
+ }
9
+
10
+ public final class cases/suspend/I$DefaultImpls {
11
+ public static fun openFunction (Lcases/suspend/I;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
12
+ }
13
+
14
+ public abstract interface class cases/suspend/II : cases/suspend/I {
15
+ public fun openFunction (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
16
+ }
17
+
18
+ public final class cases/suspend/II$DefaultImpls {
19
+ public static fun openFunction (Lcases/suspend/II;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
20
+ }
21
+
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2016-2020 JetBrains s.r.o.
2
+ * Copyright 2016-2024 JetBrains s.r.o.
3
3
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
4
4
*/
5
5
@@ -58,6 +58,8 @@ class CasesPublicAPITest {
58
58
59
59
@Test fun special () { snapshotAPIAndCompare(testName.methodName) }
60
60
61
+ @Test fun suspend () { snapshotAPIAndCompare(testName.methodName) }
62
+
61
63
@Test fun whenMappings () { snapshotAPIAndCompare(testName.methodName) }
62
64
63
65
@Test fun enums () { snapshotAPIAndCompare(testName.methodName) }
You can’t perform that action at this time.
0 commit comments