Adam Cameron
i = 0
f = 0.0
d = createObject("java", "java.lang.Double").init(0)
writeDump([
i = [
i = i,
"i === i" = i === i,
"i.equals(i)" = i.equals(i),
"i.equals(i) === true" = i.equals(i) === true,
"i.getClass().getName()" = i.getClass().getName()
],
f = [
f = f,
"f === f" = f === f,
"f.equals(f)" = f.equals(f), // <------------------------ FALSE???
"f.equals(f) === true" = f.equals(f) === true,
"f.getClass().getName()" = f.getClass().getName()
],
d = [
d = d,
"d === d" = d === d,
"d.equals(d)" = d.equals(d),
"d.equals(d) === true" = d.equals(d) === true,
"d.getClass().getName()" = d.getClass().getName()
]
])
(https://trycf.com/scratch-pad/gist/0423682320d2cc1479db23f825c18d46)
Works-ish on Lucee, except for a different bug it has with the === operator 😐Adam Cameron
coldfusion.runtime.CFDouble doesn't actually implement an equals method (cf coldfusion.runtime.CFInteger that does). However this should fall back to the equals implementation in java.lang.Object which - although doing an identity check apparently - should still return true when checking an object against itself? Unless of course CF is doing something fishy with the objects referenced in CFML before they get used in the underlying Java which results in them being different objects. Entirely likely.
@priyank_adobe are you the techo bod from the CF team here?