pjfanning commented on code in PR #3382:
URL: https://github.com/apache/pekko/pull/3382#discussion_r3650589879
##########
cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/Metric.scala:
##########
@@ -271,13 +271,15 @@ private[metrics] trait MetricNumericConverter {
* May involve rounding or truncation.
*/
def convertNumber(from: Any): Either[Long, Double] = from match {
- case n: Int => Left(n)
- case n: Long => Left(n)
- case n: Double => Right(n)
- case n: Float => Right(n)
- case n: BigInt => Left(n.longValue)
- case n: BigDecimal => Right(n.doubleValue)
- case x => throw new IllegalArgumentException(s"Not a number
[$x]")
+ case n: Int => Left(n)
+ case n: Long => Left(n)
+ case n: Double => Right(n)
+ case n: Float => Right(n)
+ case n: java.math.BigInteger => Left(n.longValue)
+ case n: java.math.BigDecimal => Right(n.doubleValue)
Review Comment:
I don't understand. The PR description says that the API allows any Number.
We've never had complaints about not supporting java.math numbers. If we add
support for them, why not support other numbers?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]