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

Poor error recovery for enhanced for loop

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Duplicate
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      $ cat Test.java
      class Test {
          void m(Object object, Object[] objects) {
              for (item : objects) { }
          }
      }
      $ javac Test.java
      Test.java:3: not a statement
              for (item : objects) { }
                   ^
      Test.java:3: ';' expected
              for (item : objects) { }
                       ^
      Test.java:3: illegal start of expression
              for (item : objects) { }
                        ^
      Test.java:3: not a statement
              for (item : objects) { }
                          ^
      Test.java:3: ';' expected
              for (item : objects) { }
                                 ^
      5 errors

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jjg Jonathan Gibbons
                Reporter:
                ahe Peter Ahe
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: