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

UseLambdaForFunctionalInterface recipe should not convert when code uses a static field from enum constructor #415

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jevanlingen
Copy link
Contributor

What's changed?

No more lambda conversion for UseLambdaForFunctionalInterface recipe when the anonymous class is within a constructor of a Enum class and uses a static field of this very class.

What's your motivation?

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

… uses a static field from enum constructor
… uses a static field from enum constructor
Copy link
Contributor

@github-actions github-actions bot left a comment

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/java/org/openrewrite/staticanalysis/CovariantEquals.java
    • lines 80-80
  • src/main/java/org/openrewrite/staticanalysis/EmptyBlockVisitor.java
    • lines 215-216
  • src/main/java/org/openrewrite/staticanalysis/ExplicitInitializationVisitor.java
    • lines 72-72
    • lines 94-94
  • src/main/java/org/openrewrite/staticanalysis/FinalizeMethodArguments.java
    • lines 208-208
  • src/main/java/org/openrewrite/staticanalysis/HiddenFieldVisitor.java
    • lines 199-199
    • lines 244-244
  • src/main/java/org/openrewrite/staticanalysis/HideUtilityClassConstructorVisitor.java
    • lines 98-98
    • lines 128-128
    • lines 191-191
  • src/main/java/org/openrewrite/staticanalysis/NoRedundantJumpStatements.java
    • lines 98-98
  • src/main/java/org/openrewrite/staticanalysis/OperatorWrap.java
    • lines 96-96
    • lines 134-134
    • lines 182-182
    • lines 215-215
    • lines 246-246
    • lines 283-283
    • lines 316-316
    • lines 364-364
    • lines 397-397
  • src/main/java/org/openrewrite/staticanalysis/RenameMethodsNamedHashcodeEqualOrToString.java
    • lines 69-70
  • src/main/java/org/openrewrite/staticanalysis/ReplaceDuplicateStringLiterals.java
    • lines 249-249
  • src/main/java/org/openrewrite/staticanalysis/TernaryOperatorsShouldNotBeNested.java
    • lines 357-357
  • src/main/java/org/openrewrite/staticanalysis/UseLambdaForFunctionalInterface.java
    • lines 73-73
    • lines 117-117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working recipe
Projects
Status: Ready to Review
Development

Successfully merging this pull request may close these issues.

UseLambdaForFunctionalInterface should not convert when code uses a static field from enum constructor
1 participant