diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t3692.check | 14 | ||||
-rw-r--r-- | test/files/neg/t3692.scala | 17 |
2 files changed, 31 insertions, 0 deletions
diff --git a/test/files/neg/t3692.check b/test/files/neg/t3692.check new file mode 100644 index 0000000000..ce89a6563d --- /dev/null +++ b/test/files/neg/t3692.check @@ -0,0 +1,14 @@ +t3692.scala:11: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead + case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] + ^ +t3692.scala:12: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead + case m1: Map[Int, V] => new java.util.HashMap[Integer, V] + ^ +t3692.scala:13: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead + case m2: Map[T, Int] => new java.util.HashMap[T, Integer] + ^ +t3692.scala:13: error: unreachable code + case m2: Map[T, Int] => new java.util.HashMap[T, Integer] + ^ +three warnings found +one error found diff --git a/test/files/neg/t3692.scala b/test/files/neg/t3692.scala new file mode 100644 index 0000000000..78b0e4b843 --- /dev/null +++ b/test/files/neg/t3692.scala @@ -0,0 +1,17 @@ +object ManifestTester { + def main(args: Array[String]) = { + val map = Map("John" -> 1, "Josh" -> 2) + new ManifestTester().toJavaMap(map) + } +} + +class ManifestTester { + private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { + map match { + case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] + case m1: Map[Int, V] => new java.util.HashMap[Integer, V] + case m2: Map[T, Int] => new java.util.HashMap[T, Integer] + case _ => new java.util.HashMap[T, V] + } + } +}
\ No newline at end of file |