Skip to content

Conversation

@ptahchiev
Copy link

As per this question:

http://stackoverflow.com/questions/37866041/why-is-javax-money-currencyunit-not-serializable

I would like to suggest to make the javax.money.CurrencyUnit interface extend java.io.Serializable.

As per this question:

http://stackoverflow.com/questions/37866041/why-is-javax-money-currencyunit-not-serializable

I would like to suggest to make the javax.money.CurrencyUnit interface extend java.io.Serializable.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.44% when pulling f96f84c on ptahchiev:master into 1176507 on JavaMoney:master.

@keilw
Copy link
Member

keilw commented Jun 16, 2016

Based on an answer by Brian Goetz himself;-) It does not seem necessary to extend Serializable on the API level. Although Money-API has a few elements right now that make it difficult for Java ME Embedded, the most core types like CurrencyUnit or MonetaryAmount should ideally be portable and Serializable is not on ME. If you look at JSR 310 (java.time) a concrete class like ChronoUnit (actually it's an Enum which does the trick) implements Serializable, but the closest equivalent to CurrencyUnit https://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalUnit.html (in fact the naming was partly influenced by that given Stephen's also in the EG) does not extend it.
Furthermore, extending Serializable directly in CurrencyUnit would make it impossible to use enums to implement it (which some implementations may do) since a class cannot implement the same interface twice. Therefore closing this.

@keilw keilw closed this Jun 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants