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

DecorateAsScala.propertiesAsScalaMapConverter has incorrect type

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: Scala 2.10.1
    • Fix Version/s: None
    • Component/s: Collections
    • Labels:
      None

      Description

      According to the javadoc, http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html is a Hashtable[Object, Object], yet the conversion tries to view it as a Map[String, String]

        implicit def propertiesAsScalaMapConverter(p: ju.Properties): AsScala[mutable.Map[String, String]] =
          new AsScala(propertiesAsScalaMap(p))
      

        Activity

        Hide
        Simon Ochsenreither added a comment -

        I think Sun just messed up generifying that class. Properties consists only of (String, String) pairs as far as I know.

        Show
        Simon Ochsenreither added a comment - I think Sun just messed up generifying that class. Properties consists only of (String, String) pairs as far as I know.
        Hide
        Eugene Burmako added a comment -

        Noone prevents anyone from putting objects there: https://github.com/scala/scala/pull/2505, so I guess we should be prepared.

        Show
        Eugene Burmako added a comment - Noone prevents anyone from putting objects there: https://github.com/scala/scala/pull/2505 , so I guess we should be prepared.
        Hide
        Paul Phillips added a comment -

        "Because Properties inherits from Hashtable, the put and putAll methods can be applied to a Properties object. Their use is strongly discouraged as they allow the caller to insert entries whose keys or values are not Strings. The setProperty method should be used instead. If the store or save method is called on a "compromised" Properties object that contains a non-String key or value, the call will fail. Similarly, the call to the propertyNames or list method will fail if it is called on a "compromised" Properties object that contains a non-String key."

        Show
        Paul Phillips added a comment - "Because Properties inherits from Hashtable, the put and putAll methods can be applied to a Properties object. Their use is strongly discouraged as they allow the caller to insert entries whose keys or values are not Strings. The setProperty method should be used instead. If the store or save method is called on a "compromised" Properties object that contains a non-String key or value, the call will fail. Similarly, the call to the propertyNames or list method will fail if it is called on a "compromised" Properties object that contains a non-String key."
        Hide
        Jason Zaugg added a comment -

        Okay, I'm happy for a Won't Fix on this one.

        Show
        Jason Zaugg added a comment - Okay, I'm happy for a Won't Fix on this one.

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Eugene Burmako
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development