Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the Usage of altAnnotationQualifiedName in JavaParser #4343

Open
CJunHub opened this issue Nov 27, 2024 · 1 comment
Open

About the Usage of altAnnotationQualifiedName in JavaParser #4343

CJunHub opened this issue Nov 27, 2024 · 1 comment

Comments

@CJunHub
Copy link

CJunHub commented Nov 27, 2024

I am using the following for Java code parsing: https://github.com/antlr/grammars-v4/blob/master/java/java/JavaParser.g4

The code related to altAnnotationQualifiedName is as follows:

// ANNOTATIONS
altAnnotationQualifiedName
    : (identifier DOT)* '@' identifier
    ;

annotation
    : ('@' qualifiedName | altAnnotationQualifiedName) (
        '(' ( elementValuePairs | elementValue)? ')'
    )?
    ;

Question
Under what circumstances would altAnnotationQualifiedName be used? Java does not support the syntax xxx.xxx.xxx.@yyy, right?

@kaby76
Copy link
Contributor

kaby76 commented Nov 27, 2024

I cannot say how it would be used. But it seems that it may be an error, because I cannot see how the rule(s) were obtained from Annotation from the JLS. This is sort of the problem: people make changes thinking it's okay. Then, they pass it through a single example and declare "victory!"

Feel free to come up with an alternative refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants