From c6b50282ab25c092af21b81080f863f8b44d08dc Mon Sep 17 00:00:00 2001 From: Antoine Gourlay Date: Tue, 29 Apr 2014 00:02:02 +0200 Subject: SI-8504 fix NPE in the Java wrapper for a Scala Map. MapWrapper blindly calls .hashCode on keys that can very well be null. --- test/junit/scala/collection/convert/MapWrapperTest.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') 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 + } } -- cgit v1.2.3