clarkwtc commented on PR #19071:
URL: https://github.com/apache/kafka/pull/19071#issuecomment-2695069201

   @frankvicky 
   Sure, using declaring `KTable<String, String>` during the building works as 
well, Previously, I wanted to resolve declaring  `KTableImpl<String, String, 
String>` causing the unchecked cast by declaring `var`.
   
   I think using `var` looks cleaner than explicitly declaring the variable 
type in the following example.
   ```
   @Test
   public void 
shouldNotEnableSendingOldValuesIfNotMaterializedAlreadyAndNotForcedToMaterialize()
 {
       final StreamsBuilder builder = new StreamsBuilder();
   
       final var kTable = assertInstanceOf(KTableImpl.class, 
builder.table("topic1", consumed));
       kTable.enableSendingOldValues(false);
   
       assertFalse(kTable.sendingOldValueEnabled());
   }
   ```
   
   In this case, I can’t use the KTable<String, String> interface; I must 
create a KTableImpl instance here.
   ```
   @Test
   public void 
shouldNotEnableSendingOldValuesIfNotMaterializedAlreadyAndNotForcedToMaterialize()
 {
       final StreamsBuilder builder = new StreamsBuilder();
   
       if (builder.table("topic1", consumed) instanceof KTableImpl<String, 
String, String> kTable) {
           kTable.enableSendingOldValues(false);
           assertFalse(kTable.sendingOldValueEnabled());
       }
   }
   ```


-- 
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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to