diff options
author | Ilya Maykov <ivmaykov@gmail.com> | 2013-10-03 14:42:54 -0700 |
---|---|---|
committer | Ilya Maykov <ivmaykov@gmail.com> | 2013-10-03 14:42:54 -0700 |
commit | f38f762fc645ad24f5c9a297a6e62a75e9fa4b94 (patch) | |
tree | 1eb4c0a23ca11f1245dd2a1721e691a6b7117883 /src/library | |
parent | 55a558a50bf4e020db6de2cd0bd9dbe2e5179eda (diff) | |
download | scala-f38f762fc645ad24f5c9a297a6e62a75e9fa4b94.tar.gz scala-f38f762fc645ad24f5c9a297a6e62a75e9fa4b94.tar.bz2 scala-f38f762fc645ad24f5c9a297a6e62a75e9fa4b94.zip |
SI-7883: Added a comment per CR feedback from @adriaanm, @Ichoran
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/convert/Wrappers.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/library/scala/collection/convert/Wrappers.scala b/src/library/scala/collection/convert/Wrappers.scala index 6dab7c0e02..56f1802509 100644 --- a/src/library/scala/collection/convert/Wrappers.scala +++ b/src/library/scala/collection/convert/Wrappers.scala @@ -214,6 +214,9 @@ private[collection] trait Wrappers { } override def containsKey(key: AnyRef): Boolean = try { + // Note: Subclass of collection.Map with specific key type may redirect generic + // contains to specific contains, which will throw a ClassCastException if the + // wrong type is passed. This is why we need a type cast to A inside a try/catch. underlying.contains(key.asInstanceOf[A]) } catch { case ex: ClassCastException => false |