-
Notifications
You must be signed in to change notification settings - Fork 636
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
kotlinx.serialization.properties.Properties
object name conflicts with java.util.Properties
#2914
Comments
You can also use |
Yes, sorry for not articulating this option explicitly. This is what I meant by "annoying import-wise". The declarations don't look natural in the code afterwards. |
@joffrey-bion As much sense as your point makes, it is not something that is by any means straightforward to change at this point (it breaks both source and binary compatibility). If you don't want the import alias, you can also use a type alias though. |
The last suggestion in my initial message doesn't bring any compatibility issue, though. It's just an addition that makes the conflict less likely. But admittedly it's easy enough for users to write it themselves. It's just a slight inconvenience |
Also, it's an experimental API, so it is technically possible to break source and binary compatibility. Not nice and easy, but the ship hasn't sailed |
There is certainly something to be said about adding the helper function for this case. (and maybe |
When dealing with serialization to
Properties
format, there is a high chance that we're using both Java'sProperties
type and Kotlin'sProperties
object. This is quite annoying import-wise.Renaming to something different would be nice, although it would also unfortunately break the pattern of naming the serializer object like the format.
Alternatively, providing extensions like
Properties.decodeFromFile<T>(path: Path)
might solve the problem because we wouldn't have to first read the file into ajava.util.Properties
instance, convert it to a map, and then call theProperties
deserialization.The text was updated successfully, but these errors were encountered: