Little confuse about decay function source code

hi guys, I recently read some source code about the decay function.
there is some code doc, I can't figure out why it should be.

the code line is:
https://github.com/elastic/elasticsearch/blob/13fb93511c23fe0d1a02de07644a0415253010c5/server/src/main/java/org/elasticsearch/script/ScoreScriptUtils.java#L236

doc:
// as java.lang.Math#abs(long) is a forbidden API, have to use this comparison instead

why this doc said, the Math.abs is a forbidden API? As far as I know, this API is ok for calling.

anyone who can give me a hit above is generous.

thanks a lot.

It's easy to assume that Math.abs only returns non-negative results, but
Math.abs(Integer.MIN_VALUE) is Integer.MIN_VALUE which is negative. This has caused bugs in the past so it's best to avoid it.

thanks for your reply, had a try about Math.abs(Integer.MIN_VALUE) after your hit.
this feature I didn't know before.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.