Showing content from https://github.com/pmd/pmd/issues/1848 below:
[java] Local classes should preserve their modifiers · Issue #1848 · pmd/pmd · GitHub
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)
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4