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

Improperly formatted if-statement slips past the syntax checker.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • tools
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      If a semi-colon is placed right after a close-paren of an if-statement, the compiler lets it through without complaint:

      if (statement); // semi-colon here is not caught
      {
           some code;
      }

      JUSTIFICATION :
      I spent several hours trying to debug a code, thinking I had some kind of data-type error, when it was only the semi-colon.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compiler complains or at least warns of the syntax problem.
      ACTUAL -
      Compiles without a warning or error.

      ---------- BEGIN SOURCE ----------
      This is very simple. See code above.
      ---------- END SOURCE ----------
      ###@###.### 2005-1-14 00:50:13 GMT

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: