Double-semicolon in import statements
Jeremy Manson
jeremymanson at google.com
Fri Aug 2 11:36:49 PDT 2013
Just out of my own curiosity, who decides whether to change the spec or
javac?
Jeremy
On Fri, Aug 2, 2013 at 10:25 AM, John Spicer <jhs at edg.com> wrote:
>
> On Aug 2, 2013, at 12:57 PM, Alex Buckley <alex.buckley at oracle.com> wrote:
>
> > 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.)
>
> I'm generally happier to ban things like extra semicolons, but it seems to
> me that "import x.y;;" should be allowed regardless of what follows.
>
> FWIW, out front end does give the appropriate error, the rules just seem
> odd to me.
>
> John.
>
> >
> > 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");
> >> }
> >> }
> >>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20130802/138a338d/attachment.html
More information about the compiler-dev
mailing list