diff --git a/rules/rules-reviewed/openjdk21/openjdk17/finalization-deprecation.windup.xml b/rules/rules-reviewed/openjdk21/openjdk17/finalization-deprecation.windup.xml new file mode 100644 index 000000000..9d315b8d7 --- /dev/null +++ b/rules/rules-reviewed/openjdk21/openjdk17/finalization-deprecation.windup.xml @@ -0,0 +1,53 @@ + + + + + This ruleset provides analysis regarding 'finalization' deprecation in OpenJDK 18 to 21. + + + + + + + + + + + + + + + + Finalization has been deprecated for removal in a future release by JDK18. It continues to work now but users should start their migration off finalizers. + Use `Cleaner` or `PhantomReference` instead (see the provided link below). + Users can test what happens with finalization disable by running with: `-finalization=disabled`. + + + + + + + + + + METHOD_CALL + + + METHOD_CALL + + + + + + + Finalization has been deprecated for removal in a future release by JDK18. It continues to work now but users should start their migration off finalizers. + Use `Cleaner` or `PhantomReference` instead (see the provided link below). + Users can test what happens with finalization disable by running with: `-finalization=disabled`. + + + + + + + diff --git a/rules/rules-reviewed/openjdk21/openjdk17/tests/data/FinalizationDeprecation.java b/rules/rules-reviewed/openjdk21/openjdk17/tests/data/FinalizationDeprecation.java new file mode 100644 index 000000000..14478a436 --- /dev/null +++ b/rules/rules-reviewed/openjdk21/openjdk17/tests/data/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/finalization-deprecation.windup.test.xml b/rules/rules-reviewed/openjdk21/openjdk17/tests/finalization-deprecation.windup.test.xml new file mode 100644 index 000000000..00766efc3 --- /dev/null +++ b/rules/rules-reviewed/openjdk21/openjdk17/tests/finalization-deprecation.windup.test.xml @@ -0,0 +1,23 @@ + + + data + ../finalization-deprecation.windup.xml + + + + + + + + + + + + + + + + + diff --git a/rules/rules-reviewed/openjdk21/openjdk21.windup.technologytransformer.xml b/rules/rules-reviewed/openjdk21/openjdk21.windup.technologytransformer.xml new file mode 100644 index 000000000..0477b88dd --- /dev/null +++ b/rules/rules-reviewed/openjdk21/openjdk21.windup.technologytransformer.xml @@ -0,0 +1,8 @@ + + + + + + + +