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

xor: inner.x^=y getting different results than inner.x = inner.x^y

XMLWordPrintable

    • beta3
    • x86
    • windows_nt
    • Verified



      Name: boT120536 Date: 11/09/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      public class Trial { // NOTE: this works in JDK-1.2.2 but not in JDK-1.3
      private class Inner {
      // NOTE: if this is protected everything works as normal
      private int data = 4711;
      }

      public void strange() {
      Inner inner = new Inner();
      inner.data ^= 42; // NOTE: "inner.data = inner.data ^ 42" works
      System.out.println(inner.data);
      // ERROR: output: 77 (should be 4685)
      }

      public static void main(String[] args) {
      Trial trial = new Trial();
      trial.strange();
      }
      }
      (Review ID: 111420)
      ======================================================================

            gafter Neal Gafter (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: