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

Poor error recovery for enhanced for loop

XMLWordPrintable

    • generic
    • generic

      $ 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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: