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

Generally "Primary" in "Primary.staticSomething" should be evaluated.

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • tools
    • x86
    • windows_nt



      Name: clC74495 Date: 10/28/98


      To repro: Compile and run the follwing program.

      Expected: Both of f1() and f2() are called.

      Actual : Only f2() was called.

      Comment :
      self-inconsistent behavior.
      Generally "Primary" in "Primary.staticSomething" should be evaluated.
      If evaluating f2() is correct f1() should be evaluated also.

      -----------------------------------------------------------
      class O {
      public static void main(String[]args) {
      new O();
      }
      O() {
      f1().super(); // even if the value of f() would be trashed
      // f() itself should be evaluated.(BUG)

      f2().staticField = 0; // f() evaluated correctly!!(OK)
      }

      static int staticField;
      static O f1() {
      System.out.println("f1() called!!");
      return null;
      }
      static O f2() {
      System.out.println("f2() called!!");
      return null;
      }
      static class Nested {}
      }
      ----------------------------------------------------

      ---<Log>----------------------------
      B:\wk>javac O.jav

      B:\wk>java O
      f2() called!!

      B:\wk>
      ------------------------------------
      (Review ID: 41279)
      ======================================================================

            wmaddoxsunw William Maddox (Inactive)
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: