diff options
author | Paolo Giarrusso <p.giarrusso@gmail.com> | 2012-08-20 00:07:41 +0200 |
---|---|---|
committer | Paolo Giarrusso <p.giarrusso@gmail.com> | 2012-08-20 19:14:18 +0200 |
commit | 079e9e33327c497572c918f7d3155882b484e9ff (patch) | |
tree | f8b57640dbc915982dd1a7eabb714ae1a3dfab5b /test/files/pos | |
parent | c32b189a2a2575512d0dc8d91a400d773b53a7f0 (diff) | |
download | scala-079e9e33327c497572c918f7d3155882b484e9ff.tar.gz scala-079e9e33327c497572c918f7d3155882b484e9ff.tar.bz2 scala-079e9e33327c497572c918f7d3155882b484e9ff.zip |
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
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/javaConversions-2.10-regression.scala | 11 |
1 files changed, 11 insertions, 0 deletions
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]() +} |