ijuma commented on a change in pull request #9299: URL: https://github.com/apache/kafka/pull/9299#discussion_r492077814
########## File path: core/src/main/scala/kafka/admin/ZkSecurityMigrator.scala ########## @@ -128,7 +129,7 @@ object ZkSecurityMigrator extends Logging { // Now override any set system properties with explicitly-provided values from the config file // Emit INFO logs due to camel-case property names encouraging mistakes -- help people see mistakes they make info(s"Found ${zkTlsConfigFileProps.size()} ZooKeeper client configuration properties in file $filename") - zkTlsConfigFileProps.asScala.foreach { case (key, value) => + zkTlsConfigFileProps.asScala.forKeyValue { (key, value) => Review comment: See https://github.com/apache/kafka/commit/847ff8f55735568fe879d490af297e047b994f5e for an explanation why `asScala` still makes sense when dealing with `Properties`. ########## File path: core/src/main/scala/kafka/utils/Implicits.scala ########## @@ -46,4 +47,21 @@ object Implicits { } + /** + * Exposes `foreachKv` which maps to `foreachEntry` in Scala 2.13 and `foreach` in Scala 2.12 + * (with the help of scala.collection.compat). `foreachEntry` avoids the tuple allocation and + * is more efficient. + * + * This was not named `foreachEntry` to avoid `unused import` warnings in Scala 2.13 (the implicit + * would not be triggered in Scala 2.13 since `Map.foreachEntry` would have precedence). + */ + @nowarn("cat=unused-imports") + implicit class MapExtensionMethods[K, V](private val self: scala.collection.Map[K, V]) extends AnyVal { + import scala.collection.compat._ + def foreachKv[U](f: (K, V) => U): Unit = { Review comment: Checked with @hachikuji and he's fine with this change. ---------------------------------------------------------------- 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: us...@infra.apache.org