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

Fix record declarations nested in annotation declarations #4460

Conversation

johannescoetzee
Copy link
Contributor

@johannescoetzee johannescoetzee commented Jun 6, 2024

From the grammar

AnnotationTypeMemberDeclaration:
    AnnotationTypeElementDeclaration
    ConstantDeclaration
    ClassDeclaration
    InterfaceDeclaration
    ;
ClassDeclaration:
    NormalClassDeclaration
    EnumDeclaration
    RecordDeclaration

it is possible to declare a record as a child of an annotation declaration, but this case is currently not handled, leading to parse errors. This PR adds that case to the JavaParser grammar with some tests. I added the lpp test to make sure it works, but no fixes were required there.

(I discovered this issue when parsing some larger projects to see if there are any more switch-related bugs, but this is an older bug that is unrelated to any recent changes)

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.003%. Comparing base (d5b5d4b) to head (9d4305d).
Report is 1 commits behind head on master.

Current head 9d4305d differs from pull request most recent head efd064d

Please upload reports for the commit efd064d to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##            master     #4460       +/-   ##
=============================================
+ Coverage   51.999%   52.003%   +0.003%     
=============================================
  Files          507       507               
  Lines        28654     28654               
  Branches      4969      4969               
=============================================
+ Hits         14900     14901        +1     
+ Misses       11685     11684        -1     
  Partials      2069      2069               
Flag Coverage Δ
AlsoSlowTests 52.003% <ø> (+0.003%) ⬆️
javaparser-core 52.003% <ø> (+0.003%) ⬆️
javaparser-symbol-solver 52.003% <ø> (+0.003%) ⬆️
jdk-10 51.999% <ø> (+0.003%) ⬆️
jdk-11 51.999% <ø> (+0.003%) ⬆️
jdk-12 51.999% <ø> (+0.003%) ⬆️
jdk-13 51.999% <ø> (+0.003%) ⬆️
jdk-14 51.999% <ø> (+0.003%) ⬆️
jdk-15 51.999% <ø> (+0.003%) ⬆️
jdk-16 51.999% <ø> (+0.003%) ⬆️
jdk-17 51.999% <ø> (+0.003%) ⬆️
jdk-18 51.999% <ø> (+0.003%) ⬆️
jdk-8 51.998% <ø> (+0.003%) ⬆️
jdk-9 51.999% <ø> (+0.003%) ⬆️
macos-latest 51.992% <ø> (ø)
ubuntu-latest 51.996% <ø> (+0.003%) ⬆️
windows-latest 51.982% <ø> (+0.003%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13487dd...efd064d. Read the comment docs.

@johannescoetzee johannescoetzee changed the title Allow records in annotation declarations Fix record declarations nested in annotation declarations Jun 6, 2024
@jlerbsc jlerbsc merged commit 5902b93 into javaparser:master Jun 6, 2024
33 of 38 checks passed
@jlerbsc jlerbsc added this to the next release milestone Jun 6, 2024
@jlerbsc jlerbsc added the PR: Added A PR that introduces new behaviour (e.g. functionality, tests) label Jun 6, 2024
@jlerbsc
Copy link
Collaborator

jlerbsc commented Jun 6, 2024

Thank you for your attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Added A PR that introduces new behaviour (e.g. functionality, tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants