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

javac wrongly accepts semicolons in package and import decls

    XMLWordPrintable

Details

    • b16

    Description

      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

      Attachments

        Issue Links

          There are no Sub-Tasks for this issue.

          Activity

            People

              acobbs Archie Cobbs
              abuckley Alex Buckley
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: