Ensure, RI-BP is in sync (JAVAMONEY-124)

[JAVAMONEY-158] Ensure JApiCmp reports are comparable for Moneta and Moneta-BP Created: 18/Jan/16  Updated: 17/Nov/16

Status: Open
Project: javamoney
Component/s: Impl: RI
Affects Version/s: 1.1
Fix Version/s: 1.2

Type: Sub-task Priority: Major
Reporter: keilw Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to JAVAMONEY-148 Analyze Dependencies Resolved
Tags: design

 Description   

Using JApiCmp we have to ensure, the reports (including non-critical info or warning e.g. for added methods, etc.) are comparable or identical for Moneta and Moneta-BP.



 Comments   
Comment by stokito [ 07/Sep/16 ]

For those who didn't know what is JApiCmp (like me minute ago)
japicmp is a tool to compare two versions of a jar archive:
https://siom79.github.io/japicmp/
https://github.com/siom79/japicmp





[JAVAMONEY-146] RoundedMoney not immutable Created: 27/Aug/15  Updated: 17/Nov/16

Status: Reopened
Project: javamoney
Component/s: Impl: RI
Affects Version/s: 1.0
Fix Version/s: 1.2

Type: Improvement Priority: Minor
Reporter: keilw Assignee: otaviojava
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: test

 Description   

There's a warning by the TCK seemingly since 1.0 about RoundedMoney not being immutable:

Warning: found non immutable MonetaryAmountType: org.javamoney.moneta.RoundedMoney, details: 
Expected: org.javamoney.moneta.RoundedMoney to be IMMUTABLE
     but: org.javamoney.moneta.RoundedMoney is actually NOT_IMMUTABLE
    Reasons:
        Field can have an abstract type (javax.money.MonetaryRounding) assigned to it. [Field: rounding, Class: org.javamoney.moneta.RoundedMoney]
        The 'this' reference is passed outwith the constructor. [Class: org.javamoney.moneta.RoundedMoney]
        The 'this' reference is passed outwith the constructor. [Class: org.javamoney.moneta.RoundedMoney]
        The 'this' reference is passed outwith the constructor. [Class: org.javamoney.moneta.RoundedMoney]
        The 'this' reference is passed outwith the constructor. [Class: org.javamoney.moneta.RoundedMoney]
    Allowed reasons:
        Field can have an abstract type (javax.money.CurrencyUnit) assigned to it. [Field: currency, Class: org.javamoney.moneta.RoundedMoney]
        Field can have an abstract type (javax.money.CurrencyUnit) assigned to it. [Field: currency, Class: org.javamoney.moneta.RoundedMoney]
        Field can have an abstract type (javax.money.MonetaryOperator) assigned to it. [Field: rounding, Class: org.javamoney.moneta.RoundedMoney]

Is there a reason for it being not immutable, or can this be addressed?



 Comments   
Comment by otaviojava [ 27/Aug/15 ]

It's talking of the Monetary Operator that could be a mutable type, it's looking just to the interface.
But don't worry, the implementations are immutables and I checked again the RoundedMoney. It's immutable.

Comment by keilw [ 28/Aug/15 ]

The message refers to other issues, especially this used outside the constructor of RoundedMoney in places the add() method:

MoneyUtils.checkAmountParameter(amount, this.currency);

Let's fix it so hopefully all warnings go away.

Comment by otaviojava [ 28/Aug/15 ]

Thanks Werner by the information.
I am looking it so or do you are fixing it?





[JAVAMONEY-166] MonetaryAmountFormat should expose regular expression that will match the format Created: 19/Oct/16  Updated: 13/Nov/16

Status: Open
Project: javamoney
Component/s: Impl: RI
Affects Version/s: None
Fix Version/s: 1.2

Type: Improvement Priority: Major
Reporter: Oliver Gierke Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

It would be cool if a MonetaryAmountFormat exposed a regular expression that'd allow clients to verify a potential input value for MAF.format(…).

The concrete use case is that a REST API might want to support Locale specific representations based on an Accept-Language header present in the request. The Locale derived from that can be used to obtain the corresponding format. However, if you'd like to expose e.g. a JSON schema for the based on that header, there's currently no way to obtain that format from the MonetaryAmountFormat.



 Comments   
Comment by keilw [ 19/Oct/16 ]

Sounds interesting, but an API change can't be done without at least a MR1.

There is at least one other issue similar to https://github.com/jsr107/jsr107spec/issues/333 (recently solved by JSR 107, still pending a MR, but the Spec Leads agreed on doing it) which a MR of JSR 354 could help solve.

It looks like Credit Suisse hasn't had much luck finding a Maintenance Lead, so any change to the API or license could be problematic.
I don't suppose VMware (Pivotal is not a JCP member, but Oliver represented VMware in JPA 2.1 and a colleague was in the JBatch EG) or a successor as JCP Member would consider helping with that, e,g. as Co Maintenance Lead? (either with CS, Trivadis or both)

Comment by Oliver Gierke [ 21/Oct/16 ]

Actually I thought about suggesting it for the reference implementation first, but I couldn't find a tracker to file issues for that on the GitHub repository.

Comment by otaviojava [ 12/Nov/16 ]

Hello Oliver.

What do you think of MonetaryAmountDecimalFormatBuilder class?
Is that enough to you?
https://github.com/JavaMoney/jsr354-ri/blob/master/moneta-core/src/main/java/org/javamoney/moneta/format/MonetaryAmountDecimalFormatBuilder.java
https://github.com/JavaMoney/jsr354-ri/blob/master/moneta-core/src/test/java/org/javamoney/moneta/format/MonetaryAmountDecimalFormatBuilderTest.java

Comment by otaviojava [ 13/Nov/16 ]

I created this PR: https://github.com/JavaMoney/jsr354-ri/pull/139

Comment by Oliver Gierke [ 13/Nov/16 ]

That's a nice start but it lacks two important things: it's not a regular expression (so it's not universally useful) and it doesn't include the currency.

Comment by otaviojava [ 13/Nov/16 ]

Oliver once it's a DecimalFormat's wrapper.
We can use currency any way with ¤ (\u00A4)

Ref: https://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormat.html

Comment by Oliver Gierke [ 13/Nov/16 ]

Well, I don't think that takes the concrete setup (symbol VS three-digit code) into account. I think the ideal way'd be to just expose a real regular expression rather than letting the client doing some arbitrary post processing. A `DecimalFormat` pattern would be useful if I wanted to do some formatting on my own but that's not what I want to do and actually what the formatting API already does OOTB.





[JAVAMONEY-160] equal can return false for the same CurrencyUnits Created: 19/Feb/16  Updated: 05/Jun/16

Status: Open
Project: javamoney
Component/s: Impl: RI
Affects Version/s: None
Fix Version/s: 1.1.1

Type: Bug Priority: Major
Reporter: walec51 Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I have one currency unit created from jackson-datatype-money deserialization and the other one from Monetary.getCurrency(locale). Both refer to USD but when I try to compare them using equal I get false.

This behavior is very surprising. The reason for this was that one MonetaryUnit was a BuildableCurrencyUnit and the other one was a JDKCurrencyAdapter and their equals implementations are not symmetrical.

JDKCurrencyAdapter has
if (obj instanceof CurrencyUnit) { ...

BuildableCurrencyUnit has
if (obj instanceof BuildableCurrencyUnit) { ...
this is wrong and it should be implemented as in JDKCurrencyAdapter



 Comments   
Comment by keilw [ 19/Feb/16 ]

Interesting, we may have a look into it (given both RIs are currently working on a maintenance pack it sounds like good timing) but keep in mind, e.g. Java's own Integer and BigInteger both created with the same value 1, 2 or any number never return true on equals() either. So it could be a "works as Java intended" case, but if there's a domain specific deviation we may accomplish here we'll give it a try.

Comment by tommy_ludwig [ 16/Mar/16 ]

I also have run into this problem comparing MonetaryAmount objects deserialized from JSON using jackson-datatype-money with ones instantiated using Money.of(number, currency). You can see a demonstration of this in JUnit tests in this gist. I understand the precedent of the Number classes, but two Money objects being compared should not return different values depending on the order of the equality check. The equals method states that it should be symmetric.

I think it is mostly a problem of usability and consistency. There are workarounds (Money#compareTo), but they make things a bit ugly and it is just too easy to use "the wrong thing" (in this case equals). Money#isEqualTo works if you know the currencies are the same or are okay handling the MonetaryException in case of mismatched currencies, but I don't know that and want to compare equality in a stream.

Comment by keilw [ 04/Jun/16 ]

@tommy_ludwig Please add a separate ticket for equals() and instances of MonetaryAmount we can't abuse this one for other classes or types. thanks.

Comment by keilw [ 04/Jun/16 ]

Seems this could also be related: https://github.com/JavaMoney/jsr354-ri/pull/134

Comment by tommy_ludwig [ 05/Jun/16 ]

@keilw I think that pull request may fix all of the mentioned problems, which I believe have the root cause mentioned in the description of this issue. My comment was adding more background/use cases that might run into this problem. I will be glad to test my use case once the pull request has been merged. If I find remaining/additional problems after that pull request change, I'll be sure to open new tickets. Thank you for looking into this.





[JAVAMONEY-137] Make Moneta Modular Created: 16/Jul/15  Updated: 04/Jun/16

Status: In Progress
Project: javamoney
Component/s: Impl: RI
Affects Version/s: 1.1
Fix Version/s: 1.2

Type: Task Priority: Major
Reporter: keilw Assignee: keilw
Resolution: Unresolved Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Sub-Tasks:
Key
Summary
Type
Status
Assignee
JAVAMONEY-138 Core Module Sub-task Resolved keilw  
JAVAMONEY-139 Format Module Sub-task Resolved  
JAVAMONEY-140 Convert Module Sub-task Resolved keilw  
JAVAMONEY-141 Pass TCK Sub-task Resolved keilw  
JAVAMONEY-148 Analyze Dependencies Sub-task Resolved keilw  
Tags: modules

 Description   

Anticipating future Java versions beyond 9 (Jigsaw) Moneta (and Moneta BP which will be required as "standalone" RI even if some day one could be added to platform umbrella) we plan to break Moneta into smaller modules.

Especially the "convert" package, likely "format" and at least a "core" module underneath. Some of these modules may have companion modules, e.g. "convert" with default providers for ECB and IMF.






Ensure, RI-BP is in sync (JAVAMONEY-124)

[JAVAMONEY-135] Ensure Unit Test coverage and results are comparable Created: 22/Jun/15  Updated: 04/Jun/16

Status: Reopened
Project: javamoney
Component/s: Impl: RI
Affects Version/s: 1.1
Fix Version/s: 1.2

Type: Sub-task Priority: Critical
Reporter: keilw Assignee: otaviojava
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to JAVAMONEY-104 Make coverage visible on all key arti... Open
Tags: test

 Description   

Currently there is a large difference between Moneta and Moneta-BP when it comes to test-coverage and results:
Moneta (#307: https://travis-ci.org/JavaMoney/jsr354-ri/builds/67812171)
Tests run: 601, Failures: 21, Errors: 0, Skipped: 0
Moneta-BP (#87: https://travis-ci.org/JavaMoney/jsr354-ri-bp/builds/67811489)
Tests run: 440, Failures: 19, Errors: 0, Skipped: 0

The total number of tests differs drastically. The number of failures less, but it should be 0 or close to 0 (or rather a few @Ignore should there be a good reason why it fails) in both cases.



 Comments   
Comment by keilw [ 22/Jun/15 ]

We do have some external dependencies, especially IMF or ECB conversion providers are Integration Tests not just simple "Unit Tests" in their nature, but ideally those should all be green till the 3rd party system changes or breaks something, too

Comment by otaviojava [ 22/Jun/15 ]

The solution to fix JAVA MONEY-131, has broke some tests.
The issue was reopened and the code rollbacked.

Comment by keilw [ 22/Jun/15 ]

I am sure it did not solve the 200 "missing" tests in Moneta-BP?

Comment by otaviojava [ 22/Jun/15 ]

this time you are wrong, I fixed on moneta-bp too.
https://github.com/JavaMoney/jsr354-ri-bp/pull/16

Comment by keilw [ 22/Jun/15 ]

Tests run: 440, Failures: 0
vs.
Tests run: 601, Failures: 2

is not comparable test coverage. Moneta-BP is not a second class citizen, in fact till Java EE 8 gets SE 8 Enterprise ready it is first class.

Comment by keilw [ 08/Feb/16 ]

This https://coveralls.io/github/JavaMoney/jsr354-ri does not even exist for jsr354-bp. It must be set up the same way it was for Moneta.





[JAVAMONEY-104] Make coverage visible on all key artifacts Created: 13/May/15  Updated: 04/Jun/16

Status: Open
Project: javamoney
Component/s: API, General: Build and quality management, Impl: RI, Test: TCK
Affects Version/s: 1.0
Fix Version/s: 1.0.1, 1.2

Type: Task Priority: Minor
Reporter: keilw Assignee: atsticks
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVAMONEY-125 Add missing tests Resolved
Relates
relates to JAVAMONEY-135 Ensure Unit Test coverage and results... Reopened
Tags: coverage, test

 Description   

Considerable effort was spent on increasing code coverage recently. Similar to the public API: https://github.com/JavaMoney/jsr354-api (showing 76% that's not bad, unless you're into safety critical software even corporate projects often don't insist on more than 60 or 70%) its BP and all other major artifacts (RI+RI-BP as well as TCK where applicable) should present theirs, too. API-BP has a badge, but no Coveralls profile seems to exist. Where missing, those should be created.






[JAVAMONEY-106] Clarify and document RI on JavaMoney page Created: 13/May/15  Updated: 04/Jun/16

Status: In Progress
Project: javamoney
Component/s: General: Build and quality management, Impl: RI
Affects Version/s: 1.0
Fix Version/s: 1.2

Type: Task Priority: Minor
Reporter: keilw Assignee: keilw
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: documentation, website

 Description   

While jcp.org will provide download links to official releases, many people likely will either use Maven settings or visit JavaMoney.org.

There http://javamoney.github.io/ri.html RI/Moneta is still presented as "1.0-RC1" and there's no clarification about 2 flavors of the RI for Java SE 8 or above and the still more widely expected one running SE 6/7, Android or Java ME.

This should be clarified and explained in the Readme.



 Comments   
Comment by keilw [ 08/Feb/16 ]

There's a need to update this page whenever 1.(0.)1 goes live.





[JAVAMONEY-155] make ConvertNumberValue public Created: 25/Sep/15  Updated: 27/Sep/15

Status: Open
Project: javamoney
Component/s: Impl: RI
Affects Version/s: 1.0
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: msgilligan Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: 2 hours
Time Spent: Not Specified
Original Estimate: 2 hours


 Description   

When extending NumberValue, implementing numberValue(Class<T> numberType) and numberValueExact(Class<T> numberType) is non-trivial.

For those willing to add a dependency on the RI, it would be nice to be able to use the ConvertNumberValue enum. Can it be made public?



 Comments   
Comment by otaviojava [ 27/Sep/15 ]

I don't think it's the good idea:

  • This class is not the goal of the API
  • Once this class public we need to take care any refactoring, in other words, any improvements or change in this class it will slower.
  • To remove this class one day if public it will spend more time, one to deprecated it and then to finally remove it.
Comment by keilw [ 27/Sep/15 ]

Well the same goes for other RI elements like MonetaryUtil which was public and has to be restored, or if it was to stay in a similar form MonetaryOperators and other RI level public elements. I don't see if we add all sorts of stuff in a function package why this should not be available the same way.

Comment by msgilligan [ 27/Sep/15 ]

The problem is that any class implementing NumberValue is required to implement

<T extends Number> T numberValue(Class<T> numberType)

which is essentially a requirement to convert to any of the built-in number types. So every implementation is being forced to implement this functionality.

Perhaps making ConvertNumberValue isn't the best API or implementation to make public. But something should be provided by the RI and possibly even specified in a future version of the API. In fact, I'd go so far as to say that an arbitrary Number to Number conversion should be included in the JDK itself.

Comment by msgilligan [ 27/Sep/15 ]

The ideal solution might be something like this:

1. NumberValue (or a provided subclass) would require a no-parameters numberValue() method that would return a Number of the same type that getNumberType() returns. This would be the default or preferred representation of the internal type.

abstract public Number numberValue();

I'm not sure whether there would need to be a no-parameters version of numberValueExact or if we could safely assume that the preferred conversion would always be exact.

2. This provided abstract base class would provide an implementation of numberValue(Class<T> numberType) similar to:

public <T extends Number> T numberValue(Class<T> numberType) {
        return ConvertNumberValue.of(numberType, numberValue());
}

Summary

Implementing classes would provide a method to convert to the optimal standard Number type. The framework itself would provide the method that converts to any of the standard subtypes. This would make creating an implementation of NumberValue much easier as only a conversion to a single type would be required. In most cases I would imagine that type would be Long, BigInteger, or BigDecimal.





[JAVAMONEY-142] Define some tests as "integration-test" Created: 27/Jul/15  Updated: 23/Aug/15

Status: Open
Project: javamoney
Component/s: Impl: RI
Affects Version/s: 1.0
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: keilw Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVAMONEY-125 Add missing tests Resolved
Tags: test

 Description   

Some CI servers like Circle-CI call mvn integration-test by default. For those tests in need of external services by ECB, IMF, Yahoo, etc. we should try to rebrand them into "Integration Tests" and run them separately or optionally where necessary. See http://stackoverflow.com/questions/1399240/how-do-i-get-my-maven-integration-tests-to-run






Generated at Tue Jan 24 16:18:35 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.