[ 
https://issues.apache.org/jira/browse/KAFKA-10534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

linenwei updated KAFKA-10534:
-----------------------------
    Summary: Modify the AbstractConfig  class,  convert parameter `originals` 
type from Map<?, ?> to Map<String, ?>  to avoid redundant judgments in the code 
 (was: Modify the originals parameter type of the AbstractConfig class to avoid 
redundant judgments in the code)

> 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
>            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.3.4#803005)

Reply via email to