diff --git a/rules/rules-reviewed/openjdk21/openjdk17/removed-apis.windup.xml b/rules/rules-reviewed/openjdk21/openjdk17/removed-apis.windup.xml new file mode 100644 index 000000000..8e3bcb972 --- /dev/null +++ b/rules/rules-reviewed/openjdk21/openjdk17/removed-apis.windup.xml @@ -0,0 +1,75 @@ + + + + + This ruleset provides analysis regarding removed APIs in OpenJDK 18 to 21. + + + + + + + + + + + + METHOD_CALL + + + METHOD_CALL + + + METHOD_CALL + + + + + + + This finalization method has been removed between JDK 18 and 21 and must be removed from the code. + + + + + + + + METHOD_CALL + + + + + + The `java.lang.ThreadGroup.allowThreadSuspension` method has been removed and cannot be used anymore. + + + + + + + + + + + + The `java.lang.Compiler` method has been removed and cannot be used anymore. + + + + + + + + + + + + The `javax.management.remote.rmi.RMIIIOPServerImpl` method has been removed and cannot be used anymore. + + + + + + diff --git a/rules/rules-reviewed/openjdk21/openjdk17/tests/data/finalization-deprecation/FinalizationDeprecation.java b/rules/rules-reviewed/openjdk21/openjdk17/tests/data/finalization-deprecation/FinalizationDeprecation.java new file mode 100644 index 000000000..14478a436 --- /dev/null +++ b/rules/rules-reviewed/openjdk21/openjdk17/tests/data/finalization-deprecation/FinalizationDeprecation.java @@ -0,0 +1,23 @@ +import javax.imageio.stream.FileImageOutputStream; +import java.io.File; + +public class FinalizationDeprecation extends Object { + + public static void main(String[] args) { + FinalizationDeprecation o1 = new FinalizationDeprecation(); + o1.finalize(); + + Runtime runtime = Runtime.getRuntime(); + runtime.runFinalization(); + + System.runFinalization(); + + FileImageOutputStream stream = new FileImageOutputStream(new File("hey")); + stream.finalize(); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + } +} \ No newline at end of file diff --git a/rules/rules-reviewed/openjdk21/openjdk17/tests/data/removed-apis/RemovedApis.java b/rules/rules-reviewed/openjdk21/openjdk17/tests/data/removed-apis/RemovedApis.java new file mode 100644 index 000000000..3315b2fd1 --- /dev/null +++ b/rules/rules-reviewed/openjdk21/openjdk17/tests/data/removed-apis/RemovedApis.java @@ -0,0 +1,23 @@ +import java.awt.color.ICC_Profile; +import java.awt.image.ColorModel; +import java.awt.image.IndexColorModel; +import java.lang.Compiler; +import javax.management.remote.rmi.RMIIIOPServerImpl; + +public class FinalizationDeprecation extends Object { + + public static void main(String[] args) { + ICC_Profile profile = ICC_Profile.getInstance(1); + profile.finalize(); + + ColorModel colorModel = ColorModel.getRGBdefault(); + colorModel.finalize(); + + IndexColorModel indexColorModel = IndexColorModel.getRGBdefault(); + indexColorModel.finalize(); + + ThreadGroup threadGroup = new ThreadGroup(); + threadGroup.allowThreadSuspension(); + } + +} \ No newline at end of file diff --git a/rules/rules-reviewed/openjdk21/openjdk17/tests/finalization-deprecation.windup.test.xml b/rules/rules-reviewed/openjdk21/openjdk17/tests/finalization-deprecation.windup.test.xml index 00766efc3..05e0d0786 100644 --- a/rules/rules-reviewed/openjdk21/openjdk17/tests/finalization-deprecation.windup.test.xml +++ b/rules/rules-reviewed/openjdk21/openjdk17/tests/finalization-deprecation.windup.test.xml @@ -2,7 +2,7 @@ - data + data/finalization-deprecation ../finalization-deprecation.windup.xml diff --git a/rules/rules-reviewed/openjdk21/openjdk17/tests/removed-apis.windup.test.xml b/rules/rules-reviewed/openjdk21/openjdk17/tests/removed-apis.windup.test.xml new file mode 100644 index 000000000..8a993dd21 --- /dev/null +++ b/rules/rules-reviewed/openjdk21/openjdk17/tests/removed-apis.windup.test.xml @@ -0,0 +1,59 @@ + + + data/removed-apis + ../removed-apis.windup.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +