vvcephei commented on a change in pull request #9361:
URL: https://github.com/apache/kafka/pull/9361#discussion_r498604821



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorContextImpl.java
##########
@@ -135,16 +132,17 @@ public void logChange(final String storeName,
      * @throws StreamsException if an attempt is made to access this state 
store from an unknown node
      * @throws UnsupportedOperationException if the current streamTask type is 
standby
      */
+    @SuppressWarnings("unchecked")

Review comment:
       It's because we're returning a subtype of StateStore now, but the stores 
are still internally not typed, so someone still has to cast it.
   
   For example, here's what the old API was like:
   ```java
   KeyValueStore<String, Integer> store = (KeyValueStore<String, Integer>) 
context.getStateStore("asdf");
   ```
   The cast is in the user's code.
   
   Now, it will be like this:
   ```java
   KeyValueStore<String, Integer> store = context.getStateStore("asdf");
   ```
   The return type is resolved by the type system, and the cast moves into our 
code.
   
   Just to clarify, there's no extra safety here, it's a cast either way. It's 
just more convenient for callers not to have to cast on their end.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to