summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAntoine Gourlay <antoine@gourlay.fr>2014-04-29 00:02:02 +0200
committerAntoine Gourlay <antoine@gourlay.fr>2014-04-29 00:02:02 +0200
commitc6b50282ab25c092af21b81080f863f8b44d08dc (patch)
tree7e3f0bd602f5e2abe3a8170ea6d55fea6214c078 /test
parentca9003e453873c496c72c431f0e5f9f3eaf31511 (diff)
downloadscala-c6b50282ab25c092af21b81080f863f8b44d08dc.tar.gz
scala-c6b50282ab25c092af21b81080f863f8b44d08dc.tar.bz2
scala-c6b50282ab25c092af21b81080f863f8b44d08dc.zip
SI-8504 fix NPE in the Java wrapper for a Scala Map.
MapWrapper blindly calls .hashCode on keys that can very well be null.
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/collection/convert/MapWrapperTest.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/junit/scala/collection/convert/MapWrapperTest.scala b/test/junit/scala/collection/convert/MapWrapperTest.scala
index 060b6b5937..22eaf858ea 100644
--- a/test/junit/scala/collection/convert/MapWrapperTest.scala
+++ b/test/junit/scala/collection/convert/MapWrapperTest.scala
@@ -46,4 +46,14 @@ class MapWrapperTest {
assertFalse(javaMap.containsKey(null)) // negative test, null key
assertEquals(4, scalaMap.containsCounter)
}
+
+ // test for SI-8504
+ @Test
+ def testHashCode() {
+ import scala.collection.JavaConverters._
+ val javaMap = Map(1 -> null).asJava
+
+ // Before the fix for SI-8504, this throws a NPE
+ javaMap.hashCode
+ }
}