groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Fernández Marsal (JIRA) <j...@apache.org>
Subject [jira] [Updated] (GROOVY-8929) Inconsistent equals and hashCode for arrays
Date Mon, 17 Dec 2018 08:40:00 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-8929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Albert Fernández Marsal updated GROOVY-8929:
--------------------------------------------
    Description: 
{code}
09:29:~$ groovysh
Groovy Shell (2.4.14, JVM: 1.8.0_171)
Type ':help' or ':h' for help.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# int[]
groovy:000> a = [1,2,3] as int[]
===> [1, 2, 3]
groovy:000> a.class
===> class [I
groovy:000> b = [1,2,3] as int[]
===> [1, 2, 3]
groovy:000> b.class
===> class [I
groovy:000> a == b
===> true
groovy:000> a.hashCode()
===> 1329315688
groovy:000> b.hashCode()
===> 1489933928
# String[]
groovy:000> c = ['a', 'b'] as String[]
===> [a, b]
groovy:000> d = ['a', 'b'] as String[]
===> [a, b]
groovy:000> c == d
===> true
groovy:000> c.hashCode()
===> 319689067
groovy:000> d.hashCode()
===> 6422064
groovy:000>
{code}

  was:
{code}
09:29:~$ groovysh
Groovy Shell (2.4.14, JVM: 1.8.0_171)
Type ':help' or ':h' for help.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
groovy:000> a = [1,2,3] as int[]
===> [1, 2, 3]
groovy:000> a.class
===> class [I
groovy:000> b = [1,2,3] as int[]
===> [1, 2, 3]
groovy:000> b.class
===> class [I
groovy:000> a == b
===> true
groovy:000> a.hashCode()
===> 1329315688
groovy:000> b.hashCode()
===> 1489933928
groovy:000>
{code}


> Inconsistent equals and hashCode for arrays
> -------------------------------------------
>
>                 Key: GROOVY-8929
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8929
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.14
>            Reporter: Albert Fernández Marsal
>            Priority: Major
>
> {code}
> 09:29:~$ groovysh
> Groovy Shell (2.4.14, JVM: 1.8.0_171)
> Type ':help' or ':h' for help.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> # int[]
> groovy:000> a = [1,2,3] as int[]
> ===> [1, 2, 3]
> groovy:000> a.class
> ===> class [I
> groovy:000> b = [1,2,3] as int[]
> ===> [1, 2, 3]
> groovy:000> b.class
> ===> class [I
> groovy:000> a == b
> ===> true
> groovy:000> a.hashCode()
> ===> 1329315688
> groovy:000> b.hashCode()
> ===> 1489933928
> # String[]
> groovy:000> c = ['a', 'b'] as String[]
> ===> [a, b]
> groovy:000> d = ['a', 'b'] as String[]
> ===> [a, b]
> groovy:000> c == d
> ===> true
> groovy:000> c.hashCode()
> ===> 319689067
> groovy:000> d.hashCode()
> ===> 6422064
> groovy:000>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message