Skip to content

Configurable NoFinalizedLocalVariables for excluding methods parameters#548

Merged
timtebeek merged 4 commits into
mainfrom
514-configurable-no-finalized-local-variables
May 9, 2025
Merged

Configurable NoFinalizedLocalVariables for excluding methods parameters#548
timtebeek merged 4 commits into
mainfrom
514-configurable-no-finalized-local-variables

Conversation

@steve-aom-elliott

@steve-aom-elliott steve-aom-elliott commented May 8, 2025

Copy link
Copy Markdown
Contributor

What's changed?

  • An option has been added to NoFinalizedLocalVariables to allow final method/lambda parameters to be excluded from having their final designation removed.
  • Added ability for final fields declared within lambdas to have their final modifier removed in the same way they get cleaned up for regular method declarations.

Checklist

… return statements. Modified condition on `RemoveUnneededBlock` to allow for block flattening even if it contains variable declarations as long as it also contains a return (which when combined with `RemoveUnreachableCodeVisitor` should be able to prevent issues that might crop up due to descoping the first block.
…arameters` option to be able to skip the removal of final method / lambda parameters.
@steve-aom-elliott steve-aom-elliott self-assigned this May 8, 2025
@steve-aom-elliott steve-aom-elliott added the enhancement New feature or request label May 8, 2025
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite May 8, 2025

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • src/main/resources/META-INF/rewrite/examples.yml
    • lines 474-473
    • lines 636-652
    • lines 698-697
    • lines 1587-1586
    • lines 2311-2310
    • lines 2326-2338

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • src/main/resources/META-INF/rewrite/examples.yml
    • lines 474-473
    • lines 636-652
    • lines 698-697
    • lines 1587-1586
    • lines 2311-2310
    • lines 2326-2338

@timtebeek timtebeek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! Nice to see a steady stream of improvements.

@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite May 9, 2025
@timtebeek timtebeek marked this pull request as ready for review May 9, 2025 13:20
@timtebeek timtebeek merged commit 480ead1 into main May 9, 2025
@timtebeek timtebeek deleted the 514-configurable-no-finalized-local-variables branch May 9, 2025 13:20
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Feature request: configurable NoFinalizedLocalVariables

2 participants