Menu ▾ ▴

#8 Error in grammer

open
5
2002-02-11
2002-02-10
No

Pizza is unable to correctly parse the following code:

...
Object x = Array.newInstance(int[].class, 1);
...

The problem is the use of the .class reflection field
on an array type, which fails somewhere in "term4" I
think.

It should be fairly easy to change the Parser, but I
don't have the time right now.

I have checked that the JDK correctly parses it.

Discussion

  • Nick Fortescue

    Nick Fortescue - 2002-02-11

    Logged In: YES
    user_id=251678

    OK. Just checked this with the relevant bit of the Java
    Language Specification. For those interested, page 328, in
    my copy, section 15.8.2, "A class literal is an expression
    consiting of the name of a class, interface, array or
    primitive type followed by a '.' and token class.

    So this is definitely required syntax. I'll add a test case
    and look at adding it.

     
  • Nick Fortescue

    Nick Fortescue - 2002-02-11
    • labels: 371504 --> Java Language Specification
     

Log in to post a comment.