summaryrefslogtreecommitdiff
path: root/test/files/run/t5804.scala
diff options
context:
space:
mode:
authorAleksandar Prokopec <axel22@gmail.com>2012-05-18 19:07:06 +0200
committerAleksandar Prokopec <axel22@gmail.com>2012-05-18 19:07:06 +0200
commitf51dbd556480d42ea563623251a428b5b690571e (patch)
tree7045a17572d6be111c33b14971e9d3087139d47c /test/files/run/t5804.scala
parent34fa132820ddef5d789dd6efd00dc2f3a1d27a63 (diff)
downloadscala-f51dbd556480d42ea563623251a428b5b690571e.tar.gz
scala-f51dbd556480d42ea563623251a428b5b690571e.tar.bz2
scala-f51dbd556480d42ea563623251a428b5b690571e.zip
Fixes SI-5804.
The hash table initialSize method is now within the the hashset and hashmap classes, and not in the companion. Overriding this method now yields hashmaps and hashsets of the proper initial capacity. Review by @phaller.
Diffstat (limited to 'test/files/run/t5804.scala')
-rw-r--r--test/files/run/t5804.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/files/run/t5804.scala b/test/files/run/t5804.scala
new file mode 100644
index 0000000000..b96a736035
--- /dev/null
+++ b/test/files/run/t5804.scala
@@ -0,0 +1,32 @@
+
+
+import collection.mutable._
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ class CustomHashMap extends HashMap[Int, Int] {
+ override def initialSize = 65
+
+ println(table.length)
+ }
+
+ new CustomHashMap
+ new HashMap {
+ println(table.length)
+ }
+
+ class CustomHashSet extends HashSet[Int] {
+ override def initialSize = 96
+
+ println(table.length)
+ }
+
+ new CustomHashSet
+ new HashSet {
+ println(table.length)
+ }
+ }
+
+}