Uploaded image for project: 'Scala'
  1. Scala
  2. SCALA-531

BsonArray.apply has useless overloads

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.7.0
    • Component/s: bson
    • Labels:
      None
    • Environment:
      All

      Description

      BsonArray.apply has two overloads to the `def apply(elems: CanBeBsonValue*): BsonArray` signature.
      The first one takes no parameters and is useless since it's the same as passing no args to the vararg signature.
      The second one takes an `Iterable[BsonValue]` and this one tripped me up bad, because I wanted to call this one, but after some long debugging session found out I wasn't calling it at all. Instead, since any `Seq` will automatically be converted to a `BsonArray`, calling something like `BsonArray(List("Hello", "World"))` will result in `[["Hello", "World"]]`. The only way to call this method is to call it with something that is an `Iterable` but not a `Seq`, which is at the very least hard to come by. I suggest deleting the two overloads and adding a `fromIterable` function.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: