GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [java] Java8 parsing corner case with annotated array types · Issue #997 · pmd/pmd Closed DescriptionProblemsWith Java 8 type annotations, the dimensions of an array may each have different annotations, which our parser actually doesn't support... There are several instances of this problem: Type node// Doesn't parse int @Foo[]@Bar[] i; Our grammar: https://github.com/pmd/pmd/blob/master/pmd-java/etc/grammar/Java.jjt#L1885-L1887 Array creation expression// Doesn't parse new int @Foo[2] @Bar[]; Our grammar: https://github.com/pmd/pmd/blob/master/pmd-java/etc/grammar/Java.jjt#L2261-L2269 VariableDeclaratorIdclass Foo { int i @Bar[]; // field declaration void bar(int i@Bar[]) { // formal parameter int i @Bar[]; // local variable declaration } } Our grammar: https://github.com/pmd/pmd/blob/master/pmd-java/etc/grammar/Java.jjt#L1771-1787 Method declarationsThe JLS allows array dimensions (including annotations) to be added after the formal parameter list, eg: int method()@Foo[]@Bar[] { return new int[2][]; } By the way, even without annotations, the parser currently discards the additionnal array dimensions, though it should be used in type resolution: https://github.com/pmd/pmd/blob/master/pmd-java/etc/grammar/Java.jjt#L1822 This is related to the broader #910 changeset Solution
I imagine that could be 3 PRs Activity
|
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |