Write proto flag about compatibility mode
There is no any special aim for this flag now. But it could be useful in future in case of compatibility mode deprecation
This commit is contained in:
+7
-1
@@ -94,7 +94,13 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
writeVersionRequirementForJvmDefaultIfNeeded(descriptor, proto, versionRequirementTable)
|
||||
|
||||
if (jvmDefaultMode.forAllMethodsWithBody && isInterface(descriptor)) {
|
||||
proto.setExtension(JvmProtoBuf.jvmClassFlags, JvmFlags.getClassFlags(true))
|
||||
proto.setExtension(
|
||||
JvmProtoBuf.jvmClassFlags,
|
||||
JvmFlags.getClassFlags(
|
||||
jvmDefaultMode.forAllMethodsWithBody,
|
||||
JvmDefaultMode.ALL_COMPATIBILITY == jvmDefaultMode
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -95,7 +95,13 @@ class FirJvmSerializerExtension @JvmOverloads constructor(
|
||||
writeVersionRequirementForJvmDefaultIfNeeded(klass, proto, versionRequirementTable)
|
||||
|
||||
if (jvmDefaultMode.forAllMethodsWithBody && klass is FirRegularClass && klass.classKind == ClassKind.INTERFACE) {
|
||||
proto.setExtension(JvmProtoBuf.jvmClassFlags, JvmFlags.getClassFlags(true))
|
||||
proto.setExtension(
|
||||
JvmProtoBuf.jvmClassFlags,
|
||||
JvmFlags.getClassFlags(
|
||||
jvmDefaultMode.forAllMethodsWithBody,
|
||||
JvmDefaultMode.ALL_COMPATIBILITY == jvmDefaultMode
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,8 @@ extend Class {
|
||||
optional int32 anonymous_object_origin_name = 103 [(string_id_in_table) = true];
|
||||
|
||||
|
||||
// isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
|
||||
// first bit: isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
|
||||
// second bit: is all-compatibility mode or not, 1 - yes, 0 - no
|
||||
optional int32 jvm_class_flags = 104 [default = 0];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,12 @@ object JvmFlags {
|
||||
|
||||
//Class
|
||||
val ARE_INTERFACE_METHOD_BODIES_INSIDE = Flags.FlagField.booleanFirst()
|
||||
val IS_ALL_COMPATIBILITY_MODE = Flags.FlagField.booleanAfter(ARE_INTERFACE_METHOD_BODIES_INSIDE)
|
||||
|
||||
fun getPropertyFlags(isMovedFromInterfaceCompanion: Boolean): Int =
|
||||
IS_MOVED_FROM_INTERFACE_COMPANION.toFlags(isMovedFromInterfaceCompanion)
|
||||
|
||||
fun getClassFlags(isAllInterfaceBodiesInside: Boolean): Int =
|
||||
ARE_INTERFACE_METHOD_BODIES_INSIDE.toFlags(isAllInterfaceBodiesInside)
|
||||
fun getClassFlags(isAllInterfaceBodiesInside: Boolean, isAllCompatibilityMode: Boolean): Int =
|
||||
ARE_INTERFACE_METHOD_BODIES_INSIDE.toFlags(isAllInterfaceBodiesInside) or IS_ALL_COMPATIBILITY_MODE.toFlags(isAllCompatibilityMode)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user