Skip to content

Add Getter method to useMimeCoder field in UseJavaUtilBase64 recipe #699

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

Conversation

wapkch
Copy link
Contributor

@wapkch wapkch commented Apr 2, 2025

…cipe

What's changed?

Add Getter method to useMimeCoder field in UseJavaUtilBase64 recipe

What's your motivation?

It seems that when running a recipe with configuration parameters, there must be a Getter method to the parameter field in recipe.

For example:

---
type: specs.openrewrite.org/v1beta/recipe
name: UseJavaUtilBase64
displayName: UseJavaUtilBase64
description: UseJavaUtilBase64.
recipeList:
  - org.openrewrite.java.migrate.UseJavaUtilBase64:
      useMimeCoder: true

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

@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Apr 2, 2025
@greg-at-moderne greg-at-moderne self-requested a review April 2, 2025 07:16
Copy link
Contributor

@greg-at-moderne greg-at-moderne left a comment

Choose a reason for hiding this comment

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

For reference, @wapkch can you also paste what error happens when this is absent?

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Apr 2, 2025
@wapkch
Copy link
Contributor Author

wapkch commented Apr 2, 2025

For reference, @wapkch can you also paste what error happens when this is absent?

When this is absent, useMimeCoder field will always be false even if configured to true like this :

---
type: specs.openrewrite.org/v1beta/recipe
name: UseJavaUtilBase64
displayName: UseJavaUtilBase64
description: UseJavaUtilBase64.
recipeList:
  - org.openrewrite.java.migrate.UseJavaUtilBase64:
      useMimeCoder: true

@greg-at-moderne
Copy link
Contributor

OK. Understood. Thanks for the fix!

I've checked other pieces of code with @Option and most of them don't use the @Getter. But they use @Value on the whole class. But @Getter makes sense too.

@greg-at-moderne greg-at-moderne merged commit 61bbbe5 into openrewrite:main Apr 2, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants