Closed stokito closed 4 years ago
How complex is it to fix this in the MR? We should not suffer from Scope Creep especially because EVERY FIX here MUST be back-ported to Moneta-BP, while the next JSR should have a universal RI with Java 9 Multi-Release JARs where necessary to be compatible with Java 8 or similar.
The test case works with my latest changes. Not sure if it really solves the problem.
The JavaMoney's formatter internally reuses a DecimalFormat from JDK and uses the same patterns. For example the pattern
00.0 ¤
says that currency code or symbol is on the end of amount. Where it is a currency code or a symbol is determined byset(CurrencyStyle.CODE)
in format context. If theCurrencyStyle
wasn't set the it will be used theCODE
by default.But in the JavaDoc of the DecimalFormat said:
Which means that we can specify when to use a code or a symbol by the pattern itself. Here is a test case to demonstrate:
So actually users who are familiar with the pattern
¤¤
may be confused because it doesn't supported by JavaMoney and fails at all. What is interesting is that in CLDR Number Patterns this is not mentioned.So what we can do:
¤¤
and fail as it's now. At least it wasn't mentioned in CLDR patterns.CurrencyStyle
.CurrencyStyle
then use a symbol for one ¤ and currency code for ¤¤ but this will be a breaking change.