Math/max strange behavior while using OpenJ9
When using `Math/max` on OpenJ9, there's a really strange behavior: if I define a var beforehand, it breaks `Math/max`. There's an example below, with Clojure and JVM versions:
Linux (Ubuntu 16.04)
Eclipse OpenJ9 VM 1.8.0_181-b13
I don't think there's really anything to do here, and I don't think it's actually specific to J9.
In the first line, the numbers are parsed as longs and that type info is available when choosing the overloaded method of Math/max. In the last case a and b are typed as Objects, so you fall into reflection. (You can see this if you (set! warn-on-reflection true)).
My guess is that reflection is picking an unintended override, probably because it's choosing based on some arbitrary ordering that happens to be different than other jdks.
As with any reflective case, you can stop getting arbitrary results by providing type hints on a and b:
Or in the max call directly:
Comment made by: mauricio.szabo
You can work-around this issue using Clojure's `max` function, but this could affect other Java interop on J9