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

(javac) emits inaccurate diagnostics for enhanced for-loops

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 6, 8
    • tools
    • b40
    • generic
    • generic
    • Verified

      javac emits incorrect diagnostics for a bad "for-each" statement,
      here is an example:
      % javac Test.java
      Test.java:4: error: not a statement
            for (a : x) { }
                 ^
      Test.java:4: error: ';' expected
            for (a : x) { }
                  ^
      Test.java:4: error: illegal start of expression
            for (a : x) { }
                   ^
      Test.java:4: error: ';' expected
            for (a : x) { }
                    ^
      4 errors

            ksrini Kumar Srinivasan
            ksrini Kumar Srinivasan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: