Skip to content

Commit

Permalink
Merge pull request #246 from vivid-money/bumb-kotlin-and-migration
Browse files Browse the repository at this point in the history
remove java methods
  • Loading branch information
dsvag authored Nov 8, 2023
2 parents b4a36fc + d18dbe4 commit 41e4f8c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ElmStore<Event : Any, State : Any, Effect : Any, Command : Any>(
storeListeners: Set<StoreListener<Event, State, Effect, Command>>? = null,
override val startEvent: Event? = null,
private val key: String =
(reducer::class.java.canonicalName ?: reducer::class.java.simpleName).replace(
(reducer::class.qualifiedName?: reducer::class.simpleName).orEmpty().replace(
"Reducer",
"Store",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ data class Result<State : Any, Effect : Any, Command : Any>(
command: Command? = null,
) : this(
state = state,
effects = effect?.let(::listOf) ?: emptyList(),
commands = command?.let(::listOf) ?: emptyList(),
effects = listOfNotNull(effect),
commands = listOfNotNull(command),
)

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ abstract class ScreenDslReducer<Event : Any, Ui : Any, Internal : Any, State : A
val body = Result(state)
@Suppress("UNCHECKED_CAST")
when {
uiEventClass.java.isAssignableFrom(event.javaClass) -> body.ui(event as Ui)
internalEventClass.java.isAssignableFrom(event.javaClass) -> body.internal(event as Internal)
else -> error("Event ${event.javaClass} is neither UI nor Internal")
uiEventClass.isInstance(event) -> body.ui(event as Ui)
internalEventClass.isInstance(event) -> body.internal(event as Internal)
else -> error("Event ${event::class} is neither UI nor Internal")
}
return body.build()
}
Expand Down

0 comments on commit 41e4f8c

Please sign in to comment.