Double-semicolon in import statements
Alex Buckley
alex.buckley at oracle.com
Fri Aug 2 09:57:07 PDT 2013
Nope, the production is:
CompilationUnit:
PackageDeclarationopt ImportDeclarationsopt TypeDeclarationsopt
So that's a javac bug. (And a reason for minimizing undue flexibility in
the language in the first place.)
Alex
On 8/1/2013 12:59 PM, Jeremy Manson wrote:
> Alex,
>
> What about the following, which also compiles? Can you
> have ImportDeclaration TypeDeclaration ImportDeclaration?
>
> import java.util.HashMap;;
> import java.util.LinkedList;
>
> public class Semicolon {
> public static void main(String[] args) {
> System.out.println("This program should not compile");
> }
> }
>
More information about the compiler-dev
mailing list