Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8186140

java long comparison with == operator returns incorrect result.

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_144"
      Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin xx 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      jrunscript

      var a = new java.io.File("/bin/cat");

      print(typeof a.length()); // object
      print(a.length() == a.length()); // false

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      jrunscript

      var a = new java.io.File("/bin/cat");

      print(typeof a.length()); // object
      print(a.length() == a.length()); // false

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      number
      true
      ACTUAL -
      object
      false

      REPRODUCIBILITY :
      This bug can be reproduced always.

            pmuthuswamy Priya Lakshmi Muthuswamy (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: