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

Convenience comparison function javadoc doesn't match implementation #153

Open
ayush-finix opened this issue Jun 18, 2024 · 0 comments
Open

Comments

@ayush-finix
Copy link

ayush-finix commented Jun 18, 2024

Ex.

 /**
     * Compares two instances of {@link MonetaryAmount}, hereby ignoring non significant trailing
     * zeroes and different numeric capabilities.
     *
     * @param amount the {@link MonetaryAmount} to be compared with this instance.
     * @return {@code true} if {@code amount < this}.
     * @throws MonetaryException if the amount's currency is not equal to the currency of this instance.
     */
    boolean isLessThan(MonetaryAmount amount);

The java doc says that it returns true if amount < this, but every implementation (and a personal reading of this.isLessThan(amount) seems like it should) returns true if this < amount.

Ex with the reference moneta implementation

System.out.println(Money.of(BigDecimal.ONE, Monetary.getCurrency("USD"))
        .isLessThan(Money.of(BigDecimal.TEN, Monetary.getCurrency("USD"))));
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants