[java] Suppress removal warnings for finalize()

The "deprecation" warning has been changed to a "removal" warning
with newer JDK versions.  This needs to be addressed, but meanwhile
it makes running the testsuite unusably noisy so suppressing it
seems more helpful than not.

Closes: #2556
This commit is contained in:
Olly Betts 2023-04-25 12:10:35 +12:00
parent c67e4dd06f
commit 1a31e9dc0c
4 changed files with 9 additions and 3 deletions

View File

@ -7,6 +7,12 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.2.0 (in progress) Version 4.2.0 (in progress)
=========================== ===========================
2023-05-12: olly
[Java] #2556 Suppress Java removal warnings on finalize method.
SWIG will need to stop relying on finalize methods, but we know
that and meanwhile these warnings make the testsuite output very
noisy.
2023-05-11: olly 2023-05-11: olly
#302 #2079 #2474 Parse storage class more flexibly. #302 #2079 #2474 Parse storage class more flexibly.

View File

@ -7,7 +7,7 @@
%module(directors="1") java_director %module(directors="1") java_director
%typemap(javafinalize) SWIGTYPE %{ %typemap(javafinalize) SWIGTYPE %{
@SuppressWarnings("deprecation") @SuppressWarnings({"deprecation", "removal"})
protected void finalize() { protected void finalize() {
// System.out.println("Finalizing " + this); // System.out.println("Finalizing " + this);
delete(); delete();

View File

@ -183,7 +183,7 @@ try {
// Need to handle the checked exception in NoExceptTest.delete() // Need to handle the checked exception in NoExceptTest.delete()
%typemap(javafinalize) SWIGTYPE %{ %typemap(javafinalize) SWIGTYPE %{
@SuppressWarnings("deprecation") @SuppressWarnings({"deprecation", "removal"})
protected void finalize() { protected void finalize() {
try { try {
delete(); delete();

View File

@ -1304,7 +1304,7 @@ SWIG_JAVABODY_PROXY(protected, protected, SWIGTYPE)
SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE) SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE)
%typemap(javafinalize) SWIGTYPE %{ %typemap(javafinalize) SWIGTYPE %{
@SuppressWarnings("deprecation") @SuppressWarnings({"deprecation", "removal"})
protected void finalize() { protected void finalize() {
delete(); delete();
} }