8000 Fix issue #4607: don't forget to clone guard when cloning stmt.SwitchEntry by DaniilSuchkov · Pull Request #4608 · javaparser/javaparser · GitHub
[go: up one dir, main page]

Skip to content

Conversation

DaniilSuchkov
Copy link

Fixes #4607.

@jlerbsc
Copy link
Collaborator
jlerbsc commented Nov 6, 2024

You must use mvn spotless:apply to format the code you commit.

@DaniilSuchkov DaniilSuchkov force-pushed the fix-issue-4607-switch-guard-cloning branch from 61f1104 to e055205 Compare November 6, 2024 23:23
@DaniilSuchkov
Copy link
Author

@jlerbsc thank you for pointing that out! Your suggestion made me realize that I need to have another look at CONTRIBUTING.md. There I saw the recommendation to run ./run_core_metamodel_generator.sh && ./run_core_generators.sh, which I did. And it turned out, my original fix was in the wrong place: I was trying to fix the code which is autogenerated. After realizing that, I found out why it is generated incorrectly and fixed the root cause: the @AllFieldsConstructor for SwitchEntry wasn't actually initializing all the fields.

@jlerbsc
Copy link
Collaborator
jlerbsc commented Nov 7, 2024

@johannescoetzee Do you agree with these changes?

Copy link
codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 58.099%. Comparing base (b05f7bd) to head (e055205).
Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
...va/com/github/javaparser/ast/stmt/SwitchEntry.java 0.000% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##            master     #4608       +/-   ##
=============================================
+ Coverage   58.009%   58.099%   +0.090%     
=============================================
  Files          508       508               
  Lines        29778     29780        +2     
  Branches      5253      5253               
=============================================
+ Hits         17274     17302       +28     
+ Misses       10366     10340       -26     
  Partials      2138      2138               
Flag Coverage Δ
AlsoSlowTests 58.099% <75.000%> (+0.090%) ⬆️
javaparser-core 58.099% <75.000%> (+0.090%) ⬆️
javaparser-symbol-solver 58.099% <75.000%> (+0.090%) ⬆️
jdk-10 58.052% <75.000%> (+0.090%) ⬆️
jdk-11 58.065% <75.000%> (+0.090%) ⬆️
jdk-12 58.052% <75.000%> (+0.090%) ⬆️
jdk-13 58.065% <75.000%> (+0.090%) ⬆️
jdk-14 58.052% <75.000%> (+0.090%) ⬆️
jdk-15 58.065% <75.000%> (+0.090%) ⬆️
jdk-16 58.065% <75.000%> (+0.090%) ⬆️
jdk-17 58.065% <75.000%> (+0.090%) ⬆️
jdk-18 58.065% <75.000%> (+0.090%) ⬆️
jdk-8 58.068% <75.000%> (+0.090%) ⬆️
jdk-9 58.052% <75.000%> (+0.090%) ⬆️
macos-latest 58.089% <75.000%> (+0.090%) ⬆️
ubuntu-latest 58.075% <75.000%> (+0.090%) ⬆️
windows-latest 58.075% <75.000%> (+0.090%) ⬆️

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

Files with missing lines Coverage Δ
...om/github/javaparser/ast/visitor/CloneVisitor.java 42.709% <100.000%> (+2.939%) ⬆️
...thub/javaparser/metamodel/JavaParserMetaModel.java 99.703% <100.000%> (+<0.001%) ⬆️
...va/com/github/javaparser/ast/stmt/SwitchEntry.java 53.846% <0.000%> (ø)

... and 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 d324c6d...e055205. Read the comment docs.

@johannescoetzee
Copy link
Contributor
johannescoetzee commented Nov 7, 2024

This looks good to me! Adding the guard parameter to the @AllFieldsConstructor and rerunning the code generators as @DaniilSuchkov did is the correct fix

Edit: The fact that the style check passed for the current iteration also means there are no manual changes in the PR that will be overwritten by the code generators

@jlerbsc jlerbsc merged commit f71c0b9 into javaparser:master Nov 7, 2024
35 checks passed
@jlerbsc jlerbsc added this to the next release milestone Nov 7, 2024
@jlerbsc jlerbsc added the PR: Fixed A PR that offers a fix or correction label Nov 7, 2024
@jlerbsc
Copy link
Collaborator
jlerbsc commented Nov 7, 2024

Thank you for this contribution.

@DaniilSuchkov
Copy link
Author

Thank you for reviewing it so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Fixed A PR that offers a fix or correction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

javaparser.ast.stmt.SwitchEntry.clone doesn't copy the guard expression

3 participants

0