Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#517 Parser error with obscure syntax

release_1.0
closed
None
7
2013-11-13
2008-07-02
Oliver Burn
No

The Java parser fails to parse the following segment of code:

    Other o = new Other() {
        <EE> void getMoreFoo() {
    }
};

It is from the attached file. The parse fails with a NPE.

Discussion

  • Oliver Burn
    Oliver Burn
    2008-07-02

    Sample bad input.

     
  • Oliver Burn
    Oliver Burn
    2008-07-02

    Logged In: YES
    user_id=218824
    Originator: YES

    I should add that this was found by Travis Schneeberger in patch #1956561. I am raising this defect to I can submit his patch and work around the bug.

    Hopefully you get some time to apply your ANTLR magic Michael. :-)

     
  • Archie Cobbs
    Archie Cobbs
    2010-02-11

    I have been seeing this problem for a long time and the bug still exists in checkstyle 5.0 by the way.

    I don't get an NPE however. Instead, checkstyle reports "Foo.java:4:15: unexpected token: x" on this example:

    class Foo {
    void method() {
    Object x = new Object() {
    <E> void foo() {
    }
    };
    }
    }

     
  • Roman Ivanov
    Roman Ivanov
    2013-11-13

    • status: open --> closed
    • Group: --> release_1.0
     
  • Roman Ivanov
    Roman Ivanov
    2013-11-13

    Closed. works fine in EclipseCS 5.6