Skip to content

Commit

Permalink
Seal the protocol factory interface (#2215)
Browse files Browse the repository at this point in the history
The only subtype should be the generated interface which is itself open to new subtypes.
  • Loading branch information
JakeWharton authored Jul 31, 2024
1 parent 63f55f8 commit fa9e1f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ New:
- Introduce a `LoadingStrategy` interface to manage `LazyList` preloading.

Changed:
- Nothing yet!
- `ProtocolFactory` interface is now sealed as arbitrary subtypes were never supported. Only schema-generated subtypes should be used.

Fixed:
- Nothing yet!
Expand Down
10 changes: 5 additions & 5 deletions redwood-protocol-host/api/redwood-protocol-host.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ abstract interface <#A: kotlin/Any> app.cash.redwood.protocol.host/GeneratedProt
abstract fun widgetChildren(app.cash.redwood.protocol/WidgetTag): kotlin.collections/List<app.cash.redwood.protocol/ChildrenTag> // app.cash.redwood.protocol.host/GeneratedProtocolFactory.widgetChildren|widgetChildren(app.cash.redwood.protocol.WidgetTag){}[0]
}

abstract interface <#A: kotlin/Any> app.cash.redwood.protocol.host/ProtocolFactory { // app.cash.redwood.protocol.host/ProtocolFactory|null[0]
abstract val widgetSystem // app.cash.redwood.protocol.host/ProtocolFactory.widgetSystem|{}widgetSystem[0]
abstract fun <get-widgetSystem>(): app.cash.redwood.widget/WidgetSystem<#A> // app.cash.redwood.protocol.host/ProtocolFactory.widgetSystem.<get-widgetSystem>|<get-widgetSystem>(){}[0]
}

abstract interface app.cash.redwood.protocol.host/ProtocolMismatchHandler { // app.cash.redwood.protocol.host/ProtocolMismatchHandler|null[0]
abstract fun onUnknownChildren(app.cash.redwood.protocol/WidgetTag, app.cash.redwood.protocol/ChildrenTag) // app.cash.redwood.protocol.host/ProtocolMismatchHandler.onUnknownChildren|onUnknownChildren(app.cash.redwood.protocol.WidgetTag;app.cash.redwood.protocol.ChildrenTag){}[0]
abstract fun onUnknownModifier(app.cash.redwood.protocol/ModifierTag) // app.cash.redwood.protocol.host/ProtocolMismatchHandler.onUnknownModifier|onUnknownModifier(app.cash.redwood.protocol.ModifierTag){}[0]
Expand All @@ -29,6 +24,11 @@ abstract interface app.cash.redwood.protocol.host/ProtocolMismatchHandler { // a
}
}

sealed interface <#A: kotlin/Any> app.cash.redwood.protocol.host/ProtocolFactory { // app.cash.redwood.protocol.host/ProtocolFactory|null[0]
abstract val widgetSystem // app.cash.redwood.protocol.host/ProtocolFactory.widgetSystem|{}widgetSystem[0]
abstract fun <get-widgetSystem>(): app.cash.redwood.widget/WidgetSystem<#A> // app.cash.redwood.protocol.host/ProtocolFactory.widgetSystem.<get-widgetSystem>|<get-widgetSystem>(){}[0]
}

abstract class <#A: kotlin/Any> app.cash.redwood.protocol.host/ProtocolNode { // app.cash.redwood.protocol.host/ProtocolNode|null[0]
constructor <init>(app.cash.redwood.protocol/Id, app.cash.redwood.protocol/WidgetTag) // app.cash.redwood.protocol.host/ProtocolNode.<init>|<init>(app.cash.redwood.protocol.Id;app.cash.redwood.protocol.WidgetTag){}[0]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import kotlin.native.ObjCName
* @see HostProtocolAdapter
*/
@ObjCName("ProtocolFactory", exact = true)
public interface ProtocolFactory<W : Any> {
public sealed interface ProtocolFactory<W : Any> {
public val widgetSystem: WidgetSystem<W>
}

Expand Down

0 comments on commit fa9e1f5

Please sign in to comment.