Local classes have several problems for now:
- The modifiers are not preserved (the production is called with
ClassOrInterfaceDeclaration(0), where 0 is supposed to be the modifiers)
- Modifiers can't be mixed with annotations, the lookahead explicitly needs the annotations to precede the modifiers. But mixing modifiers with annotations like
@F final @B class Local {} is just as valid for local classes as it would be for other types of class declarations.
- for a local class,
AccessNode#isPackagePrivate returns true, since there are no other visibility modifiers. A local class is not package private though... it's local.
|
/* |
|
TODO: Seems like we should be discarding the "final" |
|
after using it in the lookahead; I added a ["final|abstract"] inside |
|
ClassOrInterfaceDeclaration, but that seems like a hack that |
|
could break other things... |
|
*/ |
|
LOOKAHEAD( (Annotation())* ["final"|"abstract"] "class") (Annotation())* ClassOrInterfaceDeclaration(0) |
Local classes have several problems for now:
ClassOrInterfaceDeclaration(0), where0is supposed to be the modifiers)@F final @B class Local {}is just as valid for local classes as it would be for other types of class declarations.AccessNode#isPackagePrivatereturns true, since there are no other visibility modifiers. A local class is not package private though... it's local.pmd/pmd-java/etc/grammar/Java.jjt
Lines 2426 to 2432 in c28c34e