Skip to content

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
Member

@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
@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