Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8027682 javac wrongly accepts semicolons in package and import decls
  3. JDK-8304679

Release Note: Disallow Extra Semicolons Between "import" Statements

XMLWordPrintable

      The Java Language Specification does not allow extra semicolons to appear between `import` statements, yet the compiler was allowing them; [JDK-8027682](https://bugs.openjdk.org/browse/JDK-8027682) fixed this.

      As a result, a program like this, which previously would have compiled successfully:

          import java.util.Map;;;;
          import java.util.Set;
          class Test { }

      will now generate an error:

          Test.java:1: error: extraneous semicolon
          import java.util.Map;;;;
                               ^

      For backward compatibility, when compiling source versions prior to 21, a warning is generated instead of an error.

            acobbs Archie Cobbs
            acobbs Archie Cobbs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: