Github user xccui commented on the issue: https://github.com/apache/flink/pull/5032 Thanks for the suggestion @aljoscha. The problem is the state type is provided via a generic type parameter `S extends State`, which will be erased in runtime. Thus it's hard to do type checking in `AbstractKeyedStateBackend` unless we explicitly store and check the type for each state name (and that may affect the performance). The existing "leave alone" solution seems to be the most efficient way, but we can only get a `ClassCastException` with that. What do you think?
---