Module declarations may be annotated. Although the grammar explicitly tries to handle this,
the lookahead is not sufficient and when seeing an annotation, the TypeDeclaration branch is taken:
|
( LOOKAHEAD(2) TypeDeclaration() ( EmptyStatement() )* )* |
|
[ LOOKAHEAD({isKeyword("open") || isKeyword("module") || getToken(1).kind == AT}) ModuleDeclaration() ( EmptyStatement() )* ] |
This can be used as a test case:
@Deprecated(since = "11", forRemoval = true)
module jdk.pack {
}
Module declarations may be annotated. Although the grammar explicitly tries to handle this,
the lookahead is not sufficient and when seeing an annotation, the TypeDeclaration branch is taken:
pmd/pmd-java/etc/grammar/Java.jjt
Lines 1609 to 1610 in fa91d47
This can be used as a test case: