Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9011

(2/1).equals(2) is false; but (2/1) == (2) is true

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • syntax
    • None
    • Linux, Ubuntu 18.04

    Description

      Is it an expected behavior??

      Difference between '==' and 'equals()' observed....

       

      {{adithyan@adithyan:~$ groovy -e 'println( (2/1).equals(2) )' }}
      false
      adithyan@adithyan:~$ groovy -e 'println( (2/1) == (2) )'         
      true

      {{adithyan@adithyan:~$ groovy -v }}
      Groovy Version: 2.4.15 JVM: 1.8.0_144 Vendor: Oracle Corporation OS: Linux

       

       

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            adithyank Adithyan K

            Dates

              Created:
              Updated:

              Slack

                Issue deployment