I see, it is Groovy's friendly behavior.
Thank you, Paul.
Cheers,
Daniel.Sun
在 "paulk_asert [via Groovy]"
,2016年11月3日 下午2:43写道:
We just have to be a little careful. Rightly or wrongly (search the mailing
lists for many discussions), current Groovy's '==' tries to do 'friendly
coercion' bet
We just have to be a little careful. Rightly or wrongly (search the mailing
lists for many discussions), current Groovy's '==' tries to do 'friendly
coercion' between types to try to give a business domain friendly meaning
to equality:
String[] one = ['a', 'b', 'c']
List two = ['a', 'b', 'c']
asse
I verified the comparing of Java, which will check the type first. e.g.
new int[2][][].equals(new int[2][]) // false
new int[2].equals(new long[2]) // false
Cheers,
Daniel.Sun
在 "bo zhang [via Groovy]" ,2016年11月3日
上午9:24写道:
Yes, that's my first instinct too, but a few minutes later I found t
Yes, that's my first instinct too, but a few minutes later I found test
cases as follows:
assert [[[5, 6], [7, 8]]] as int[][][] == [[[5, 6], [7, 8]]] as Long[][][]
See
https://github.com/groovy/groovy-core/blob/master/src/test/groovy/ArrayTest.groovy#L207
I think this issue can be discussed, an
IMO, we should compare their type first. If not same, the comparing result
should be 'false'.
Cheers,
Daniel.Sun
在 "bo zhang [via Groovy]" ,2016年11月3日
06:53写道:
I'm afraid it's not a bug.
Actually, `def a=new int[2][]` means that a is an array of two null pointers
with type "int []", and `d
I'm afraid it's not a bug.
Actually, `def a=new int[2][]` means that a is an array of two null
pointers with type "int []", and `def b=new int[2][][]` means that b is an
array of two null pointers with type "int[][]", it seems that they should
be equal.
See
https://github.com/groovy/groovy-core/b