From db34df38f3d5ab3c0b35f57d581f7f327dc7dfee Mon Sep 17 00:00:00 2001 From: Sylvain Joubert Date: Mon, 23 Apr 2018 13:57:19 +0200 Subject: [PATCH] [Java] Suppress deprecation warning on finalize method Java 9 deprecates the finalize method. For now just suppress the deprecation warning. Fixes #1237 --- Examples/test-suite/java_director.i | 1 + Examples/test-suite/java_throws.i | 1 + Lib/java/java.swg | 1 + 3 files changed, 3 insertions(+) diff --git a/Examples/test-suite/java_director.i b/Examples/test-suite/java_director.i index 03d733d6a..6b2cb6dfe 100644 --- a/Examples/test-suite/java_director.i +++ b/Examples/test-suite/java_director.i @@ -7,6 +7,7 @@ %module(directors="1") java_director %typemap(javafinalize) SWIGTYPE %{ + @SuppressWarnings("deprecation") protected void finalize() { // System.out.println("Finalizing " + this); delete(); diff --git a/Examples/test-suite/java_throws.i b/Examples/test-suite/java_throws.i index bb5c6e48f..c137da804 100644 --- a/Examples/test-suite/java_throws.i +++ b/Examples/test-suite/java_throws.i @@ -192,6 +192,7 @@ try { // Need to handle the checked exception in NoExceptTest.delete() %typemap(javafinalize) SWIGTYPE %{ + @SuppressWarnings("deprecation") protected void finalize() { try { delete(); diff --git a/Lib/java/java.swg b/Lib/java/java.swg index 19e597bd9..bcab5a6fd 100644 --- a/Lib/java/java.swg +++ b/Lib/java/java.swg @@ -1273,6 +1273,7 @@ SWIG_JAVABODY_PROXY(protected, protected, SWIGTYPE) SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE) %typemap(javafinalize) SWIGTYPE %{ + @SuppressWarnings("deprecation") protected void finalize() { delete(); }