Restrict extension setter and getter operations to non-nullable T

pull/8272/head
Deanna Garcia 4 years ago
parent 50592a51ab
commit a250d3f8d8
  1. 4
      java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt
  2. 4
      java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt

@ -7,7 +7,7 @@ import com.google.protobuf.GeneratedMessageV3
operator fun <
M : GeneratedMessageV3.ExtendableMessage<M>,
B : GeneratedMessageV3.ExtendableBuilder<M, B>,
T
T : Any
> B.set(extension: ExtensionLite<M, T>, value: T) {
setExtension(extension, value)
}
@ -16,7 +16,7 @@ operator fun <
operator fun <
M : GeneratedMessageV3.ExtendableMessage<M>,
MorBT : GeneratedMessageV3.ExtendableMessageOrBuilder<M>,
T
T : Any
> MorBT.get(extension: ExtensionLite<M, T>): T = getExtension(extension)
/** Returns true if the specified extension is set on this builder. */

@ -7,14 +7,14 @@ import com.google.protobuf.GeneratedMessageLite
operator fun <
M : GeneratedMessageLite.ExtendableMessage<M, *>,
MOrBT : GeneratedMessageLite.ExtendableMessageOrBuilder<M, *>,
T
T : Any
> MOrBT.get(extension: ExtensionLite<M, T>): T = getExtension(extension)
/** Sets the current value of the proto extension in this builder. */
operator fun <
M : GeneratedMessageLite.ExtendableMessage<M, B>,
B : GeneratedMessageLite.ExtendableBuilder<M, B>,
T
T : Any
> B.set(extension: ExtensionLite<M, T>, value: T) {
setExtension(extension, value)
}

Loading…
Cancel
Save