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

valid boolean statements cannot processed by javac

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 6u21
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      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 ----------

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: