Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DecorateAsScala.propertiesAsScalaMapConverter has incorrect type #7465

Closed
scabug opened this issue May 9, 2013 · 5 comments
Closed

DecorateAsScala.propertiesAsScalaMapConverter has incorrect type #7465

scabug opened this issue May 9, 2013 · 5 comments
Assignees

Comments

@scabug
Copy link

@scabug scabug commented May 9, 2013

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))
@scabug
Copy link
Author

@scabug scabug commented May 9, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7465?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.1

@scabug
Copy link
Author

@scabug scabug commented May 9, 2013

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

@scabug
Copy link
Author

@scabug scabug commented May 9, 2013

@xeno-by said:
Noone prevents anyone from putting objects there: scala/scala#2505, so I guess we should be prepared.

@scabug
Copy link
Author

@scabug scabug commented May 9, 2013

@paulp said:
"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."

@scabug
Copy link
Author

@scabug scabug commented Jun 6, 2013

@retronym said:
Okay, I'm happy for a Won't Fix on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants