Skip to content

Commit cd7485e

Browse files
Merge pull request #1237 from square/sedwards/remove-anon
Remove Deprecated Worker, eventHandler, and action APIs
2 parents d7fbce5 + 960818c commit cd7485e

File tree

13 files changed

+44
-1003
lines changed

13 files changed

+44
-1003
lines changed

workflow-core/api/workflow-core.api

-102
Large diffs are not rendered by default.

workflow-core/src/commonMain/kotlin/com/squareup/workflow1/BaseRenderContext.kt

+11-349
Large diffs are not rendered by default.

workflow-core/src/commonMain/kotlin/com/squareup/workflow1/StatefulWorkflow.kt

-305
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,6 @@ public abstract class StatefulWorkflow<
7676
public inner class RenderContext internal constructor(
7777
baseContext: BaseRenderContext<PropsT, StateT, OutputT>
7878
) : BaseRenderContext<@UnsafeVariance PropsT, StateT, @UnsafeVariance OutputT> by baseContext {
79-
@Deprecated(
80-
"Always provide a debugging name",
81-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
82-
)
83-
public inline fun <reified CurrentStateT : StateT & Any> safeEventHandler(
84-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
85-
::defaultOnFailedCast,
86-
// Type variance issue: https://github.com/square/workflow-kotlin/issues/891
87-
crossinline update: WorkflowAction<
88-
@UnsafeVariance PropsT,
89-
StateT,
90-
@UnsafeVariance OutputT
91-
>.Updater.(currentState: CurrentStateT) -> Unit
92-
): () -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)
93-
9479
/**
9580
* Like [eventHandler], but no-ops if [state][WorkflowAction.Updater.state] has
9681
* changed to a different type than [CurrentStateT] by the time [update] fires.
@@ -144,23 +129,6 @@ public abstract class StatefulWorkflow<
144129
}
145130
}
146131

147-
@Deprecated(
148-
"Always provide a debugging name",
149-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
150-
)
151-
public inline fun <reified CurrentStateT : StateT & Any, EventT> safeEventHandler(
152-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
153-
::defaultOnFailedCast,
154-
crossinline update: WorkflowAction<
155-
@UnsafeVariance PropsT,
156-
StateT,
157-
@UnsafeVariance OutputT
158-
>.Updater.(
159-
currentState: CurrentStateT,
160-
event: EventT
161-
) -> Unit
162-
): (EventT) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)
163-
164132
public inline fun <reified CurrentStateT : StateT & Any, EventT> safeEventHandler(
165133
name: String,
166134
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
@@ -181,24 +149,6 @@ public abstract class StatefulWorkflow<
181149
}
182150
}
183151

184-
@Deprecated(
185-
"Always provide a debugging name",
186-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
187-
)
188-
public inline fun <reified CurrentStateT : StateT & Any, E1, E2> safeEventHandler(
189-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
190-
::defaultOnFailedCast,
191-
crossinline update: WorkflowAction<
192-
@UnsafeVariance PropsT,
193-
StateT,
194-
@UnsafeVariance OutputT
195-
>.Updater.(
196-
currentState: CurrentStateT,
197-
e1: E1,
198-
e2: E2
199-
) -> Unit
200-
): (E1, E2) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)
201-
202152
public inline fun <reified CurrentStateT : StateT & Any, E1, E2> safeEventHandler(
203153
name: String,
204154
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
@@ -220,25 +170,6 @@ public abstract class StatefulWorkflow<
220170
}
221171
}
222172

223-
@Deprecated(
224-
"Always provide a debugging name",
225-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
226-
)
227-
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3> safeEventHandler(
228-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
229-
::defaultOnFailedCast,
230-
crossinline update: WorkflowAction<
231-
@UnsafeVariance PropsT,
232-
StateT,
233-
@UnsafeVariance OutputT
234-
>.Updater.(
235-
currentState: CurrentStateT,
236-
e1: E1,
237-
e2: E2,
238-
e3: E3
239-
) -> Unit
240-
): (E1, E2, E3) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)
241-
242173
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3> safeEventHandler(
243174
name: String,
244175
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
@@ -261,26 +192,6 @@ public abstract class StatefulWorkflow<
261192
}
262193
}
263194

264-
@Deprecated(
265-
"Always provide a debugging name",
266-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
267-
)
268-
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3, E4> safeEventHandler(
269-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
270-
::defaultOnFailedCast,
271-
crossinline update: WorkflowAction<
272-
@UnsafeVariance PropsT,
273-
StateT,
274-
@UnsafeVariance OutputT
275-
>.Updater.(
276-
currentState: CurrentStateT,
277-
e1: E1,
278-
e2: E2,
279-
e3: E3,
280-
e4: E4
281-
) -> Unit
282-
): (E1, E2, E3, E4) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)
283-
284195
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3, E4> safeEventHandler(
285196
name: String,
286197
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
@@ -304,27 +215,6 @@ public abstract class StatefulWorkflow<
304215
}
305216
}
306217

307-
@Deprecated(
308-
"Always provide a debugging name",
309-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
310-
)
311-
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3, E4, E5> safeEventHandler(
312-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
313-
::defaultOnFailedCast,
314-
crossinline update: WorkflowAction<
315-
@UnsafeVariance PropsT,
316-
StateT,
317-
@UnsafeVariance OutputT
318-
>.Updater.(
319-
currentState: CurrentStateT,
320-
e1: E1,
321-
e2: E2,
322-
e3: E3,
323-
e4: E4,
324-
e5: E5
325-
) -> Unit
326-
): (E1, E2, E3, E4, E5) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)
327-
328218
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3, E4, E5> safeEventHandler(
329219
name: String,
330220
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
@@ -349,36 +239,6 @@ public abstract class StatefulWorkflow<
349239
}
350240
}
351241

352-
@Deprecated(
353-
"Always provide a debugging name",
354-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
355-
)
356-
public inline fun <
357-
reified CurrentStateT : StateT & Any,
358-
E1,
359-
E2,
360-
E3,
361-
E4,
362-
E5,
363-
E6
364-
> safeEventHandler(
365-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
366-
::defaultOnFailedCast,
367-
crossinline update: WorkflowAction<
368-
@UnsafeVariance PropsT,
369-
StateT,
370-
@UnsafeVariance OutputT
371-
>.Updater.(
372-
currentState: CurrentStateT,
373-
e1: E1,
374-
e2: E2,
375-
e3: E3,
376-
e4: E4,
377-
e5: E5,
378-
e6: E6
379-
) -> Unit
380-
): (E1, E2, E3, E4, E5, E6) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)
381-
382242
public inline fun <
383243
reified CurrentStateT : StateT & Any,
384244
E1,
@@ -412,39 +272,6 @@ public abstract class StatefulWorkflow<
412272
}
413273
}
414274

415-
@Deprecated(
416-
"Always provide a debugging name",
417-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
418-
)
419-
public inline fun <
420-
reified CurrentStateT : StateT & Any,
421-
E1,
422-
E2,
423-
E3,
424-
E4,
425-
E5,
426-
E6,
427-
E7
428-
> safeEventHandler(
429-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
430-
::defaultOnFailedCast,
431-
crossinline update: WorkflowAction<
432-
@UnsafeVariance PropsT,
433-
StateT,
434-
@UnsafeVariance OutputT
435-
>.Updater.(
436-
currentState: CurrentStateT,
437-
e1: E1,
438-
e2: E2,
439-
e3: E3,
440-
e4: E4,
441-
e5: E5,
442-
e6: E6,
443-
e7: E7
444-
) -> Unit
445-
): (E1, E2, E3, E4, E5, E6, E7) -> Unit =
446-
safeEventHandler("safeEventHandler", onFailedCast, update)
447-
448275
public inline fun <
449276
reified CurrentStateT : StateT & Any,
450277
E1,
@@ -480,41 +307,6 @@ public abstract class StatefulWorkflow<
480307
}
481308
}
482309

483-
@Deprecated(
484-
"Always provide a debugging name",
485-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
486-
)
487-
public inline fun <
488-
reified CurrentStateT : StateT & Any,
489-
E1,
490-
E2,
491-
E3,
492-
E4,
493-
E5,
494-
E6,
495-
E7,
496-
E8
497-
> safeEventHandler(
498-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
499-
::defaultOnFailedCast,
500-
crossinline update: WorkflowAction<
501-
@UnsafeVariance PropsT,
502-
StateT,
503-
@UnsafeVariance OutputT
504-
>.Updater.(
505-
currentState: CurrentStateT,
506-
e1: E1,
507-
e2: E2,
508-
e3: E3,
509-
e4: E4,
510-
e5: E5,
511-
e6: E6,
512-
e7: E7,
513-
e8: E8
514-
) -> Unit
515-
): (E1, E2, E3, E4, E5, E6, E7, E8) -> Unit =
516-
safeEventHandler("safeEventHandler", onFailedCast, update)
517-
518310
public inline fun <
519311
reified CurrentStateT : StateT & Any,
520312
E1,
@@ -552,43 +344,6 @@ public abstract class StatefulWorkflow<
552344
}
553345
}
554346

555-
@Deprecated(
556-
"Always provide a debugging name",
557-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
558-
)
559-
public inline fun <
560-
reified CurrentStateT : StateT & Any,
561-
E1,
562-
E2,
563-
E3,
564-
E4,
565-
E5,
566-
E6,
567-
E7,
568-
E8,
569-
E9
570-
> safeEventHandler(
571-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
572-
::defaultOnFailedCast,
573-
crossinline update: WorkflowAction<
574-
@UnsafeVariance PropsT,
575-
StateT,
576-
@UnsafeVariance OutputT
577-
>.Updater.(
578-
currentState: CurrentStateT,
579-
e1: E1,
580-
e2: E2,
581-
e3: E3,
582-
e4: E4,
583-
e5: E5,
584-
e6: E6,
585-
e7: E7,
586-
e8: E8,
587-
e9: E9
588-
) -> Unit
589-
): (E1, E2, E3, E4, E5, E6, E7, E8, E9) -> Unit =
590-
safeEventHandler("safeEventHandler", onFailedCast, update)
591-
592347
public inline fun <
593348
reified CurrentStateT : StateT & Any,
594349
E1,
@@ -630,45 +385,6 @@ public abstract class StatefulWorkflow<
630385
}
631386
}
632387

633-
@Deprecated(
634-
"Always provide a debugging name",
635-
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
636-
)
637-
public inline fun <
638-
reified CurrentStateT : StateT & Any,
639-
E1,
640-
E2,
641-
E3,
642-
E4,
643-
E5,
644-
E6,
645-
E7,
646-
E8,
647-
E9,
648-
E10
649-
> safeEventHandler(
650-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
651-
::defaultOnFailedCast,
652-
crossinline update: WorkflowAction<
653-
@UnsafeVariance PropsT,
654-
StateT,
655-
@UnsafeVariance OutputT
656-
>.Updater.(
657-
currentState: CurrentStateT,
658-
e1: E1,
659-
e2: E2,
660-
e3: E3,
661-
e4: E4,
662-
e5: E5,
663-
e6: E6,
664-
e7: E7,
665-
e8: E8,
666-
e9: E9,
667-
e10: E10
668-
) -> Unit
669-
): (E1, E2, E3, E4, E5, E6, E7, E8, E9, E10) -> Unit =
670-
safeEventHandler("safeEventHandler", onFailedCast, update)
671-
672388
public inline fun <
673389
reified CurrentStateT : StateT & Any,
674390
E1,
@@ -715,18 +431,6 @@ public abstract class StatefulWorkflow<
715431
}
716432
}
717433

718-
@Deprecated(
719-
"Always provide a debugging name.",
720-
ReplaceWith("safeAction(\"TODO: name\", onFailedCast, update)")
721-
)
722-
public inline fun <reified CurrentStateT : StateT & Any> safeAction(
723-
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
724-
::defaultOnFailedCast,
725-
noinline update: WorkflowAction<PropsT, StateT, OutputT>.Updater.(
726-
currentState: CurrentStateT
727-
) -> Unit
728-
): WorkflowAction<PropsT, StateT, OutputT> = safeAction("safeAction", onFailedCast, update)
729-
730434
/**
731435
* Like [action], but no-ops if [state][WorkflowAction.Updater.state] has
732436
* changed to a different type than [CurrentStateT] by the time [update] fires.
@@ -970,15 +674,6 @@ public inline fun <StateT, OutputT, RenderingT> Workflow.Companion.stateful(
970674
{ _, state -> render(state) }
971675
)
972676

973-
@Deprecated(
974-
"Always provide a debugging name",
975-
ReplaceWith("action(\"TODO: debugging name\", update)")
976-
)
977-
public fun <PropsT, StateT, OutputT, RenderingT>
978-
StatefulWorkflow<PropsT, StateT, OutputT, RenderingT>.action(
979-
update: WorkflowAction<PropsT, StateT, OutputT>.Updater.() -> Unit
980-
): WorkflowAction<PropsT, StateT, OutputT> = action("", update)
981-
982677
/**
983678
* Convenience to create a [WorkflowAction] with parameter types matching those
984679
* of the receiving [StatefulWorkflow]. The action will invoke the given [lambda][update]

0 commit comments

Comments
 (0)