|
16 | 16 | package org.openrewrite.java.migrate; |
17 | 17 |
|
18 | 18 | import com.fasterxml.jackson.annotation.JsonCreator; |
19 | | -import lombok.AllArgsConstructor; |
20 | 19 | import lombok.EqualsAndHashCode; |
21 | 20 | import lombok.Value; |
| 21 | +import org.jspecify.annotations.Nullable; |
22 | 22 | import org.openrewrite.ExecutionContext; |
23 | 23 | import org.openrewrite.Option; |
24 | 24 | import org.openrewrite.Recipe; |
|
28 | 28 | import org.openrewrite.java.MethodMatcher; |
29 | 29 | import org.openrewrite.java.tree.J; |
30 | 30 |
|
31 | | -@AllArgsConstructor |
32 | 31 | @EqualsAndHashCode(callSuper = false) |
33 | 32 | @Value |
34 | 33 | public class ReplaceComSunAWTUtilitiesMethods extends Recipe { |
@@ -77,14 +76,28 @@ public class ReplaceComSunAWTUtilitiesMethods extends Recipe { |
77 | 76 | String setComponentMixingCutoutShapePattern; |
78 | 77 |
|
79 | 78 | @JsonCreator |
80 | | - public ReplaceComSunAWTUtilitiesMethods() { |
81 | | - getAWTIsWindowsTranslucencyPattern = "com.sun.awt.AWTUtilities isTranslucencySupported(com.sun.awt.AWTUtilities.Translucency)"; |
82 | | - getWindowOpacityPattern = "com.sun.awt.AWTUtilities getWindowOpacity(java.awt.Window)"; |
83 | | - getWindowShapePattern = "com.sun.awt.AWTUtilities getWindowShape(java.awt.Window)"; |
84 | | - isWindowOpaquePattern = "com.sun.awt.AWTUtilities isWindowOpaque(java.awt.Window)"; |
85 | | - isTranslucencyCapablePattern = "com.sun.awt.AWTUtilities isTranslucencyCapable(java.awt.GraphicsConfiguration)"; |
86 | | - setComponentMixingCutoutShapePattern = "com.sun.awt.AWTUtilities setComponentMixingCutoutShape(java.awt.Component,java.awt.Shape)"; |
87 | | - setWindowOpacityPattern = "com.sun.awt.AWTUtilities setWindowOpacity(java.awt.Window, float)"; |
| 79 | + public ReplaceComSunAWTUtilitiesMethods( |
| 80 | + @Nullable String getAWTIsWindowsTranslucencyPattern, |
| 81 | + @Nullable String isWindowOpaquePattern, |
| 82 | + @Nullable String isTranslucencyCapablePattern, |
| 83 | + @Nullable String setWindowOpacityPattern, |
| 84 | + @Nullable String getWindowOpacityPattern, |
| 85 | + @Nullable String getWindowShapePattern, |
| 86 | + @Nullable String setComponentMixingCutoutShapePattern) { |
| 87 | + this.getAWTIsWindowsTranslucencyPattern = getAWTIsWindowsTranslucencyPattern == null ? |
| 88 | + "com.sun.awt.AWTUtilities isTranslucencySupported(com.sun.awt.AWTUtilities.Translucency)" : getAWTIsWindowsTranslucencyPattern; |
| 89 | + this.isWindowOpaquePattern = isWindowOpaquePattern == null ? |
| 90 | + "com.sun.awt.AWTUtilities isWindowOpaque(java.awt.Window)" : isWindowOpaquePattern; |
| 91 | + this.isTranslucencyCapablePattern = isTranslucencyCapablePattern == null ? |
| 92 | + "com.sun.awt.AWTUtilities isTranslucencyCapable(java.awt.GraphicsConfiguration)" : isTranslucencyCapablePattern; |
| 93 | + this.setWindowOpacityPattern = setWindowOpacityPattern == null ? |
| 94 | + "com.sun.awt.AWTUtilities setWindowOpacity(java.awt.Window, float)" : setWindowOpacityPattern; |
| 95 | + this.getWindowOpacityPattern = getWindowOpacityPattern == null ? |
| 96 | + "com.sun.awt.AWTUtilities getWindowOpacity(java.awt.Window)" : getWindowOpacityPattern; |
| 97 | + this.getWindowShapePattern = getWindowShapePattern == null ? |
| 98 | + "com.sun.awt.AWTUtilities getWindowShape(java.awt.Window)" : getWindowShapePattern; |
| 99 | + this.setComponentMixingCutoutShapePattern = setComponentMixingCutoutShapePattern == null ? |
| 100 | + "com.sun.awt.AWTUtilities setComponentMixingCutoutShape(java.awt.Component,java.awt.Shape)" : setComponentMixingCutoutShapePattern; |
88 | 101 | } |
89 | 102 |
|
90 | 103 | String displayName = "Replace `com.sun.awt.AWTUtilities` static method invocations"; |
|
0 commit comments