Double-semicolon in import statements
Jonathan Gibbons
jonathan.gibbons at oracle.com
Fri Aug 2 13:45:18 PDT 2013
In general, it is better/simpler to change javac to conform to the spec.
(Except when it is not.)
-- Jon
On 08/02/2013 11:36 AM, Jeremy Manson wrote:
> 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
> <mailto:jhs at edg.com>> wrote:
>
>
> On Aug 2, 2013, at 12:57 PM, Alex Buckley <alex.buckley at oracle.com
> <mailto: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/62894c66/attachment.html
More information about the compiler-dev
mailing list