Skip to content

Fixes #5553 : Skip UnnecessaryOptionalGet when lambda parameter is unnamed#5717

Closed
copybara-service[bot] wants to merge 0 commit intomasterfrom
test_897687911
Closed

Fixes #5553 : Skip UnnecessaryOptionalGet when lambda parameter is unnamed#5717
copybara-service[bot] wants to merge 0 commit intomasterfrom
test_897687911

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

Fixes #5553 : Skip UnnecessaryOptionalGet when lambda parameter is unnamed

UnnecessaryOptionalGet suggested replacing .get() with the lambda parameter name, but the parameter _ (unnamed variable, Java 22+) produces uncompilable code since _ cannot be referenced.

Changes:

  • Added an early return when the lambda parameter source is _
  • Added a test guarded by assume().that(Runtime.version().feature()).isAtLeast(22)

Fixes #5553

Fixes #5649

FUTURE_COPYBARA_INTEGRATE_REVIEW=#5649 from mirkoalicastro:mirkoalicastro/fix-unnecessary-optional-get-unnamed-variable bdcd042

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

Successfully merging this pull request may close these issues.

Improved suggestions when unnamed variables are used

0 participants