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

Ksolves India Limited edited comment on KAFKA-10534 at 9/2/25 8:39 AM:
-----------------------------------------------------------------------

We keep the parameter as Map<?, ?> instead of Map<String, ?> to allow 
flexibility with
config sources like java.util.Properties (typed as Map<Object,Object>) and 
other legacy
callers. The runtime check ensures keys are Strings while maintaining backward 
compatibility.

Hope this resolves your understanding 


was (Author: JIRAUSER305714):
We keep the parameter as Map<?, ?> instead of Map<String, ?> to allow 
flexibility with
config sources like java.util.Properties (typed as Map<Object,Object>) and 
other legacy
callers. The runtime check ensures keys are Strings while maintaining backward 
compatibility.

> Modify the AbstractConfig  class,  convert parameter `originals` type from 
> Map<?, ?> to Map<String, ?>  to avoid redundant judgments in the code
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-10534
>                 URL: https://issues.apache.org/jira/browse/KAFKA-10534
>             Project: Kafka
>          Issue Type: Improvement
>          Components: clients
>    Affects Versions: 2.6.0
>            Reporter: linenwei
>            Assignee: Ksolves India Limited
>            Priority: Trivial
>
> Source Code:
> {code:java}
>  @SuppressWarnings("unchecked")    
>   public AbstractConfig(ConfigDef definition, Map<?, ?> originals,  
> Map<String, ?> configProviderProps, boolean doLog){ 
>      /* check that all the keys are really strings */        
>       for (Map.Entry<?, ?> entry : originals.entrySet())            
>           if (!(entry.getKey() instanceof String))               
>               throw new ConfigException(entry.getKey().toString(),       
> entry.getValue(), "Key must be a string.");
> {code}
> In source code, I find that originals map key {color:#FF0000}must be a 
> string{color}. From my point of view,  why not use Map<String, ?> originals 
> to replace Map<?, ?> originals? thus will not need to do a judgement for the 
> key type. 
> I'm not sure if I've thought about it, but if there are other reasons for 
> doing this, I'd love to know why.
>  



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

Reply via email to