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

Spurious extra error message when parsing simple if statement

XMLWordPrintable

    • generic
    • generic

      Due to ###@###.###:

      class Test {
          {
      if (true)
      String[] s = null;
          }
      }

      Produces two error messsages:

      Test.java:4: '.class' expected
                  String[] s = null;
                           ^
      Test.java:4: not a statement
                  String[] s = null;
                        ^
      2 errors

      Also, if the [] is removed, two errors are produced:

      Test.java:4: not a statement
                  String s = null;
                  ^
      Test.java:4: ';' expected
                  String s = null;
                         ^
      2 errors

      Ideally, only the error messages saying "not a statement" should be given.

      ###@###.### 2004-07-08

            jlahoda Jan Lahoda
            ahe Peter Ahe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: