-
Sub-task
-
Resolution: Delivered
-
P4
-
21
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.
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.