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

Replace static com.sun.awt.AWTUtilities methods with Java 11 equivalents #544

Merged

Conversation

ranuradh
Copy link
Contributor

@ranuradh ranuradh commented Sep 5, 2024

What's changed?

RecipeName: org.openrewrite.java.migrate.ReplaceComSunAWTUtilitiesMethods

The following classes are not available in Java SE 11:
com.sun.awt.AWTUtilities
According to https://bugs.openjdk.org/browse/JDK-8187253, there are replacements available.

This recipe replaces several static calls in com.sun.awt.AWTUtilities with the JavaSE 11 equivalent. The methods replaced are AWTUtilities.isTranslucencySupported(), AWTUtilities.setWindowOpacity(), AWTUtilities.getWindowOpacity(),
AWTUtilities.getWindowShape(), AWTUtilities.isWindowOpaque(), AWTUtilities.isTranslucencyCapable() and AWTUtilities.setComponentMixingCutoutShape().

What's your motivation?

Java 11 Migration

Any additional context

Attaching rewrite.patch
rewrite.patch

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

@ranuradh ranuradh self-assigned this Sep 5, 2024
github-actions[bot]

This comment was marked as outdated.

@ranuradh ranuradh added the recipe Recipe requested label Sep 6, 2024
github-actions[bot]

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

@timtebeek timtebeek changed the title Recipe to replace com sun awt utilities classes Replace static com.sun.awt.AWTUtilities methods with Java 11 equivalents Sep 8, 2024
Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Great to see, thanks! I've pushed up a few small polishing commits, mostly to remove the context sensitive templates where we can avoid them (better for type attribution and performance), as well as remove the need to define method patterns in yaml again (less chance of misconfiguration, as we saw a misplaced 1( slip in.

Copy link
Contributor

@cjobinabo cjobinabo left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for working on this Anu

@timtebeek timtebeek merged commit f3a0409 into openrewrite:main Sep 10, 2024
2 checks passed
@ranuradh ranuradh deleted the recipe_replaceComSunAWTUtilitiesClasses branch September 10, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Recipe requested
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants