javac wrongly accepts semicolons in package and import decls

XMLWordPrintable

    • b16

      In the compiler-dev thread "Double-semicolon in import statements" [1], it was established that javac allows semicolons in two "interesting" places: 1) after the package declaration and before import declarations, and 2) after one import declaration and before another import declaration. Neither is permitted by the grammar in JLS 7.3. Since Eclipse conforms to the grammar, javac should conform too.

      As examples, the following are illegal:

      package p; ;;; import X; class Foo {}
      package p; import X; ;;; import Y; class Foo {}

      while the following is legal (because a top-level ; after the last import declaration represents an "empty" type declaration):

      package p; import X; ;;; class Foo {} ;;;

      [1] http://mail.openjdk.java.net/pipermail/compiler-dev/2013-August/006956.html

        There are no Sub-Tasks for this issue.

            Assignee:
            Archie Cobbs
            Reporter:
            Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: