[ 
https://issues.apache.org/jira/browse/KAFKA-9109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17564203#comment-17564203
 ] 

Romain Quinio commented on KAFKA-9109:
--------------------------------------

I've faced the same issue when upgrading a library to new PAPI, very annoying.

In order to support both old and new APIs, our decorators of 
org.apache.kafka.streams.processor.api.ProcessorContext must actually implement 
InternalProcessorContext (by extending 
org.apache.kafka.streams.processor.internals.ProcessorContextImpl) to 
workaround the cast...

> Get Rid of Cast from ProcessorContext to InternalProcessorContext
> -----------------------------------------------------------------
>
>                 Key: KAFKA-9109
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9109
>             Project: Kafka
>          Issue Type: Improvement
>          Components: streams
>            Reporter: Bruno Cadonna
>            Priority: Major
>
> The following cast is often used in Kafka Streams code.
> {code:java}
> public void init(final ProcessorContext context) {
>     internalProcessorContext = (InternalProcessorContext) context;
>     ...
> }
> {code}
> This code leads to a {{ClassCastException}} if the implementation of the 
> {{ProcessorContext}} is not an {{InternalProcessorContext}}, which defeats 
> the purpose of using interface {{ProcessorContext}} in the API.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to