Skip to content

Fix record declarations nested in annotation declarations#4460

Merged
jlerbsc merged 2 commits intojavaparser:masterfrom
johannescoetzee:johannes/fix-record-in-annotation-interface
Jun 6, 2024
Merged

Fix record declarations nested in annotation declarations#4460
jlerbsc merged 2 commits intojavaparser:masterfrom
johannescoetzee:johannes/fix-record-in-annotation-interface

Conversation

@johannescoetzee
Copy link
Copy Markdown
Collaborator

@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)

@codecov
Copy link
Copy Markdown

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
@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
Copy Markdown
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