Scala Programming Language
  1. Scala Programming Language
  2. SI-5115

MetaData.size doesn't match MetaData.iterator.size

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.0, Scala 2.9.2
    • Fix Version/s: None
    • Component/s: XML Support
    • Labels:
      None
    • Environment:

      Tried on 2.9.0.1 and trunk.

      Description

      Reading the API from Iterable I understand that size should return the number of elements to be returned by the iterator.

      MetaData breaches this contract:

      scala> <a x="x"/>.attributes.size
      res2: Int = 2
      
      scala> <a x="x"/>.attributes.iterator.size
      res3: Int = 1
      

        Activity

        Hide
        Jordi Salvat i Alabart added a comment - - edited
        Show
        Jordi Salvat i Alabart added a comment - - edited I've proposed a fix: https://github.com/scala/scala/pull/111
        Hide
        Commit Message Bot added a comment -

        (extempore in r25917) Fixes NPE using iterator with an XML attribute being null or None (SI-5052)
        Also fixes incorrect size method (SI-5115)

        Contributed by Jordi Salvat i Alabart. Closes SI-5052, SI-5115, no review.

        Show
        Commit Message Bot added a comment - (extempore in r25917 ) Fixes NPE using iterator with an XML attribute being null or None ( SI-5052 ) Also fixes incorrect size method ( SI-5115 ) Contributed by Jordi Salvat i Alabart. Closes SI-5052 , SI-5115 , no review.

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Jordi Salvat i Alabart
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development