Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EECA6200BC2 for ; Thu, 3 Nov 2016 02:38:17 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id ED573160B0A; Thu, 3 Nov 2016 01:38:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BDCA6160AFB for ; Thu, 3 Nov 2016 02:38:16 +0100 (CET) Received: (qmail 6513 invoked by uid 500); 3 Nov 2016 01:38:15 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 6499 invoked by uid 99); 3 Nov 2016 01:38:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Nov 2016 01:38:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 3CDC61A0593 for ; Thu, 3 Nov 2016 01:38:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 5.573 X-Spam-Level: ***** X-Spam-Status: No, score=5.573 tagged_above=-999 required=6.31 tests=[FORGED_HOTMAIL_RCVD2=1.187, HTML_MESSAGE=2, KAM_UNSUB1=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_SOFTFAIL=0.972, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id O7f3nc6zT1mi for ; Thu, 3 Nov 2016 01:38:13 +0000 (UTC) Received: from mbob.nabble.com (mbob.nabble.com [162.253.133.15]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 9D74B5FB2B for ; Thu, 3 Nov 2016 01:38:12 +0000 (UTC) Received: from static.162.255.23.22.macminivault.com (unknown [162.255.23.22]) by mbob.nabble.com (Postfix) with ESMTP id 2FA47351CEEE for ; Wed, 2 Nov 2016 18:29:49 -0700 (PDT) Date: Wed, 2 Nov 2016 18:38:10 -0700 (MST) From: "Daniel.Sun" To: dev@groovy.incubator.apache.org Message-ID: In-Reply-To: References: <581457BB.6010306@gmx.org> <1477824644566-5736398.post@n5.nabble.com> Subject: Re: An issue about comparing arrays MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_90161_1651817064.1478137090301" archived-at: Thu, 03 Nov 2016 01:38:18 -0000 ------=_Part_90161_1651817064.1478137090301 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 =E5=9C=A8 "bo zhang [via Groovy]" =EF=BC=8C2016=E5=B9=B411=E6=9C=883=E6=97=A5 =E4=B8=8A=E5=8D=889:24=E5=86= =99=E9=81=93=EF=BC=9A Yes, that's my first instinct too, but a few minutes later I found test cas= es as follows: assert [[[5, 6], [7, 8]]] as int[][][] =3D=3D [[[5, 6], [7, 8]]] as Long[][= ][] See https://github.com/groovy/groovy-core/blob/master/src/test/groovy/Array= Test.groovy#L207 I think this issue can be discussed, anybody has opinions? 2016-11-03 7:51 GMT+08:00 Daniel.Sun <[hidden email]>: IMO, we should compare their type first. If not same, the comparing result = should be 'false'. Cheers, Daniel.Sun =E5=9C=A8 "bo zhang [via Groovy]" =EF=BC=8C2016=E5= =B9=B411=E6=9C=883=E6=97=A5 06:53=E5=86=99=E9=81=93=EF=BC=9A I'm afraid it's not a bug. Actually, `def a=3Dnew int[2][]` means that a is an array of two null point= ers with type "int []", and `def b=3Dnew int[2][][]` means that b is an arr= ay of two null pointers with type "int[][]", it seems that they should be e= qual. See https://github.com/groovy/groovy-core/blob/master/src/test/groovy/Array= Test.groovy#L198 [http://groovy.329449.n5.nabble.com/attachment/5736458/0/QQ20161103-0%402x.= png] =E2=80=8B 2016-10-30 18:50 GMT+08:00 Daniel.Sun <[hidden email]>: Hi Jochen, I create JIRA issue GROOVY-7983(https://issues.apache.org/jira/browse/GROOVY-7983) to track the issue. BTW, the code in the email should be corrected as follow: def a =3D new int[2][] def b =3D new int[2][][] assert a =3D=3D b // expect faling Cheers, Daniel.Sun -- View this message in context: http://groovy.329449.n5.nabble.com/An-issue-a= bout-comparing-arrays-tp5736379p5736398.html Sent from the Groovy Dev mailing list archive at Nabble.com. ________________________________ If you reply to this email, your message will be added to the discussion be= low: http://groovy.329449.n5.nabble.com/An-issue-about-comparing-arrays-tp573637= 9p5736458.html To unsubscribe from An issue about comparing arrays, click here. NAML ________________________________ View this message in context: Re: An issue about comparing arrays Sent from the Groovy Dev mailing list archive at Nabble.com. ________________________________ If you reply to this email, your message will be added to the discussion be= low: http://groovy.329449.n5.nabble.com/An-issue-about-comparing-arrays-tp573637= 9p5736461.html To unsubscribe from An issue about comparing arrays, click here. NAML -- View this message in context: http://groovy.329449.n5.nabble.com/An-issue-a= bout-comparing-arrays-tp5736379p5736462.html Sent from the Groovy Dev mailing list archive at Nabble.com. ------=_Part_90161_1651817064.1478137090301 Content-Type: text/html; charset=UTF8 Content-Transfer-Encoding: quoted-printable
I verified the comparing of Java, which will check the typ= e first. e.g.

new int[2][][].equals(new int[2][]) // false
new int[2].equals(new long[2]) // false

Cheers,
Daniel.Sun



=E5=9C=A8 "bo zhang [via Groovy]" <= ml-node+[hidden email]>= =EF=BC=8C2016=E5=B9=B411=E6=9C=883=E6=97=A5 =E4=B8=8A=E5=8D=889:24=E5=86=99= =E9=81=93=EF=BC=9A

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[][][] =3D=3D [[[5, 6], [7, 8]]] as Long[][][]

I think this issue can be discussed, anybody has opinions?

2016-11-03 7:51 GMT+08:00 Daniel.Sun <[hidden email]>:
IMO, we should compare their type first. If not same, the = comparing result should be 'false'.

Cheers,
Daniel.Sun



=E5=9C=A8 "bo zhang [= via Groovy]" <ml-node+[hidden email]>=EF=BC=8C2016=E5=B9=B411=E6= =9C=883=E6=97=A5 06:53=E5=86=99=E9=81=93=EF=BC=9A

I'm afraid it's not a bug.

Actually, `def a=3Dnew int[2][]` means that a is an array of two null = pointers with type "int []", and `def b=3Dnew int[2][][]` means t= hat b is an array of two null pointers with type "int[][]", it se= ems that they should be equal.



=E2=80=8B

2016-10-30 18:50 GMT+08:00 Daniel.Sun <[hidd= en email]>:
Hi Jochen,

     I create JIRA issue
GROOVY-7983(https://issues.apache.o= rg/jira/browse/GROOVY-7983) to track the
issue.

     BTW,  the code in the email should be corrected as= follow:

def a =3D new int[2][]
def b =3D new int[2][][]
assert a =3D=3D b // expect faling

Cheers,
Daniel.Sun



--
View this message in context: http://groovy.329449.n5.nabble.com/An-issue-about-comparing-arrays-tp573637= 9p5736398.html
Sent from the Groovy Dev mailing list archive at Nabble.com.




If you reply to this email, your message wi= ll be added to the discussion below:
http://groovy.329449.n5.nabble.com/An-issue-about-comparing-arrays-tp5= 736379p5736458.html
To unsubscribe from An issue about comparing arrays, click here.
NAML


View this message in context: Re: An issue about comparing arrays

Sent from the Groovy Dev mailing list archive at Nabble.com.




If you reply to this email, your message wi= ll be added to the discussion below:
http://groovy.329449.n5.nabble.com/An-issue-about-comparing-arrays-tp5= 736379p5736461.html
To unsubscribe from An issue about comparing arrays, click here.
NAML
=09 =09 =09

View this message in context: Re: An issue about= comparing arrays
Sent from the Groovy Dev mailing list archive at Nabble.com.
------=_Part_90161_1651817064.1478137090301--