-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Number conversion issue using indriya with Scala language #313
Comments
So essentially it seems that Scala has its own type Another alternative we also hinted with #254 would be to create your own implementation of |
Thanks a lot for your fast hints on how to come around this issue! I really like the idea of providing a different implementation of indriya/src/main/java/tech/units/indriya/function/Calculus.java Lines 88 to 93 in 233f00f
Is it intentionally, that you don't use the |
That's a good question, hope @andi-huber can also say something about it, but I believe the default existed before the SPI definition, so it might need some brushing-up and streamlining. |
Hi there, I believe that is not my code and indeed it looks broken. |
Sorry, or I might just have missed the concept, because this should work ... Calculus.setCurrentNumberSystem(Calculus.getNumberSystem("org.my.NumberSystem")); ... where the ServiceLoader is used to lookup an implementation by name of |
To answer the question, yes its intentional, so when multiple |
I think it's correct, the quote was from the method |
Thanks a lot for your comments! I had in mind to simply place a |
That's already there. I am not sure, if multiple entries would be possible but Indriya only defines one anyway. |
I think we just talked about different things. If you stay on the level of your project it is doable and nearly there, as you provide some kind of "coordination" in this way, as you only provide one number system. What I thought about first is, me as a user placing a Just wanted to clarify it - at least I had some moment of confusion. 😃 |
Hey guys!
I recently experienced some issues using your lib together with the Scala language und therefore would like you to raise some awareness for this point.
The root of the problem is, that
scala.math.BigDecimal
extendsjava.lang.Number
, therefore an instance of it is accepted inQuantities#getQuantity(Number, Value)
. However, later in the processing, "only"java.math.BigDecimal
is covered:indriya/src/main/java/tech/units/indriya/function/DefaultNumberSystem.java
Lines 98 to 135 in 233f00f
Therefore
will lead to
IllegalArgumentException
.Most likely this issue is out of scope for your lib, but I just wanted to document this issue for others, that might experience that problem as well. For a better depiction I placed some examples in this example repo.
If you can provide you with any further information, please just let me know.
The text was updated successfully, but these errors were encountered: