changeset 25041:d5d61f1b6de0 stable

Deprecate java2mat function. * NEWS: Announce deprecation. * scripts/deprecated/java2mat.m: New function to issue a warning if used. Calls __java2mat__ to implement functionality. * scripts/deprecated/module.mk: Add java2mat.m to build system. * ov-java.cc (F__java2mat__): Renamed from java2mat.
author Rik <rik@octave.org>
date Wed, 28 Mar 2018 13:41:48 -0700
parents 328518881291
children ba5af45bbfc4
files NEWS libinterp/octave-value/ov-java.cc scripts/deprecated/java2mat.m scripts/deprecated/module.mk
diffstat 4 files changed, 50 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Mar 28 13:12:01 2018 -0700
+++ b/NEWS	Wed Mar 28 13:41:48 2018 -0700
@@ -307,6 +307,8 @@
       desktop              | isguirunning
       tmpnam               | tempname
       toascii              | double
+      java2mat             | __java2mat__
+
 
  ** The following functions were deprecated in Octave 4.0 and have been
     removed from Octave 4.4.
--- a/libinterp/octave-value/ov-java.cc	Wed Mar 28 13:12:01 2018 -0700
+++ b/libinterp/octave-value/ov-java.cc	Wed Mar 28 13:41:48 2018 -0700
@@ -1848,7 +1848,7 @@
 //! Initializes the fields #jvm, #jvm_attached, #jvm_lib, and
 //! #octave_thread_ID.  To ensure that java is initialized, this method is
 //! used as part of octave functions @c javaObject, @c javaMethod,
-//! @c __java_get__, @c __java_set__, and @c java2mat.
+//! @c __java_get__, @c __java_set__, and @c __java2mat__.
 
 static void
 initialize_java (void)
@@ -3180,9 +3180,9 @@
 #endif
 }
 
-DEFUN (java2mat, args, ,
+DEFUN (__java2mat__, args, ,
        doc: /* -*- texinfo -*-
-@deftypefn {} {} java2mat (@var{javaobj})
+@deftypefn {} {} __java2mat__ (@var{javaobj})
 Undocumented internal function.
 @end deftypefn */)
 {
@@ -3211,7 +3211,7 @@
 
   octave_unused_parameter (args);
 
-  err_disabled_feature ("java2mat", "Java");
+  err_disabled_feature ("__java2mat__", "Java");
 
 #endif
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/java2mat.m	Wed Mar 28 13:41:48 2018 -0700
@@ -0,0 +1,43 @@
+## Copyright (C) 2018 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <https://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {} {} java2mat (@var{javaobj})
+## @code{java2mat} is deprecated and will be removed in Octave version 4.8.
+##
+## For the next two releases, use @code{__java2mat__} if necessary, and file
+## a bug report explaining your programming use of @code{java2mat} and how it
+## can't be done with other Octave functions.
+## @end deftypefn
+
+function retval = java2mat (varargin)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "java2mat is obsolete and will be removed from a future version of Octave");
+  endif
+
+  retval = __java2mat__ (varargin{:});
+
+endfunction
+
+
+## No tests needed for alias.
+%!assert (1)
--- a/scripts/deprecated/module.mk	Wed Mar 28 13:12:01 2018 -0700
+++ b/scripts/deprecated/module.mk	Wed Mar 28 13:41:48 2018 -0700
@@ -6,6 +6,7 @@
   %reldir%/comma.m \
   %reldir%/desktop.m \
   %reldir%/isstr.m \
+  %reldir%/java2mat.m \
   %reldir%/mahalanobis.m \
   %reldir%/md5sum.m \
   %reldir%/octave_config_info.m \