From 079e9e33327c497572c918f7d3155882b484e9ff Mon Sep 17 00:00:00 2001 From: Paolo Giarrusso Date: Mon, 20 Aug 2012 00:07:41 +0200 Subject: JavaConversions: Restore source compatibility with 2.9 Readd an implicit conversion which was available in 2.9, the one from `java.util.concurrent.ConcurrentMap` (`juc.ConcurrentMap`) to the (now deprecated) type `scala.collection.mutable.ConcurrentMap`. This implicit conversion can also be used to convert from `juc.ConcurrentMap` to `collection.Map` and creates an ambiguity error in test/files/run/map_java_conversions.scala. To fix this, I have given lower priority to the new conversion. Moreover, update the documentation in `JavaConversions`: mark this conversion as deprecated and mention the new conversion which replaces it, converting to `scala.collection.concurrent.Map`. I discussed this issue previously with Paul Phillips on scala-language: https://groups.google.com/d/topic/scala-language/uXKRiGXb-44/discussion --- test/files/pos/javaConversions-2.10-regression.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/files/pos/javaConversions-2.10-regression.scala (limited to 'test/files/pos/javaConversions-2.10-regression.scala') diff --git a/test/files/pos/javaConversions-2.10-regression.scala b/test/files/pos/javaConversions-2.10-regression.scala new file mode 100644 index 0000000000..619c44b46d --- /dev/null +++ b/test/files/pos/javaConversions-2.10-regression.scala @@ -0,0 +1,11 @@ +import collection.{JavaConversions, mutable} +import JavaConversions._ +import java.util.concurrent.ConcurrentHashMap + +object Foo { + def buildCache2_9_simple[K <: AnyRef, V <: AnyRef]: mutable.ConcurrentMap[K, V] = + asScalaConcurrentMap(new ConcurrentHashMap()) + + def buildCache2_9_implicit[K <: AnyRef, V <: AnyRef]: mutable.ConcurrentMap[K, V] = + new ConcurrentHashMap[K, V]() +} -- cgit v1.2.3