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

valid boolean statements cannot processed by javac

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6u21
    • tools
    • x86
    • windows_xp

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      The specification of The Java Language Specification, Third Edition allows define the expression statement in following form:
      f() || f();
      Thus the following function f() should be valid

      abstract public boolean f1();

      public void f() {
          f1() || f1();
      }

      But javac cannot compile it.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      try to compile following class:
      public class SomeClass {
          int n = 0;
          public boolean f1() {
              return n++ % 2 == 0;
          }
          
          public void f() {
              f1() || f1();
          }
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      compilation should be successful
      ACTUAL -
      We have 1 error.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      SomeClass.java:8: not a statement

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class SomeClass {
          int n = 0;
          public boolean f1() {
              return n++ % 2 == 0;
          }
          
          public void f() {
              f1() || f1();
          }
      }

      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: