changeset 15790:921912c92102

Deprecate java_invoke, replace with javaMethod. Update all m-files to use javaMethod. * scripts/deprecated/java_invoke.m: New m-file with warning about function being deprecated. * libinterp/octave-value/ov-java.cc(Fjava_invoke, FjavaMethod): Remove java_invoke. Replace body of javaMethod with old java_invoke code. * libinterp/octave-value/ov-java.cc(do_java_invoke): Rename to do_javaMethod. * libinterp/octave-value/ov-java.cc(do_java_create): Rename to do_javaObject. * libinterp/octave-value/ov-java.h(do_java_invoke, do_java_create): Rename prototypes for functions to do_javaMethod and do_javaObject respectively. * scripts/deprecated/javafields.m, scripts/deprecated/javamethods.m, scripts/deprecated/module.mk, scripts/general/fieldnames.m, scripts/general/methods.m, scripts/java/errordlg.m, scripts/java/helpdlg.m, scripts/java/inputdlg.m, scripts/java/javaArray.m, scripts/java/javaaddpath.m, scripts/java/javaclasspath.m, scripts/java/javamem.m, scripts/java/javarmpath.m, scripts/java/listdlg.m, scripts/java/msgbox.m, scripts/java/questdlg.m, scripts/java/warndlg.m: Replace java_invoke calls with javaMethod calls.
author Rik <rik@octave.org>
date Fri, 14 Dec 2012 09:51:37 -0800
parents 8056d0e36bef
children 49f5962fa20d
files libinterp/octave-value/ov-java.cc libinterp/octave-value/ov-java.h scripts/deprecated/java_invoke.m scripts/deprecated/javafields.m scripts/deprecated/javamethods.m scripts/deprecated/module.mk scripts/general/fieldnames.m scripts/general/methods.m scripts/java/errordlg.m scripts/java/helpdlg.m scripts/java/inputdlg.m scripts/java/javaArray.m scripts/java/javaaddpath.m scripts/java/javaclasspath.m scripts/java/javamem.m scripts/java/javarmpath.m scripts/java/listdlg.m scripts/java/msgbox.m scripts/java/questdlg.m scripts/java/warndlg.m
diffstat 20 files changed, 138 insertions(+), 138 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-java.cc	Fri Dec 14 09:43:22 2012 -0800
+++ b/libinterp/octave-value/ov-java.cc	Fri Dec 14 09:51:37 2012 -0800
@@ -73,8 +73,6 @@
   Java_org_octave_Octave_needThreadedInvokation (JNIEnv *, jclass);
 }
 
-static octave_value _java_invoke (const octave_value_list& args);
-
 static JavaVM *jvm = 0;
 static bool jvm_attached = false;
 
@@ -1400,51 +1398,6 @@
   return retval;
 }
 
-// internally called from java_invoke and javaMethod.
-
-static octave_value
-_java_invoke (const octave_value_list& args)
-{
-  octave_value retval;
-
-  initialize_java ();
-
-  if (! error_state)
-    {
-      JNIEnv *current_env = octave_java::thread_jni_env ();
-
-      if (args.length () > 1)
-        {
-          std::string methodname = args(1).string_value ();
-          if (! error_state)
-            {
-              octave_value_list tmp;
-              for (int i=2; i<args.length (); i++)
-                tmp(i-2) = args(i);
-
-              if (args(0).class_name () == "octave_java")
-                {
-                  octave_java *jobj = TO_JAVA (args(0));
-                  retval = jobj->do_java_invoke (current_env, methodname, tmp);
-                }
-              else if (args(0).is_string ())
-                {
-                  std::string cls = args(0).string_value ();
-                  retval = octave_java::do_java_invoke (current_env, cls, methodname, tmp);
-                }
-              else
-                error ("java_invoke: OBJ must be a Java object or a string");
-            }
-          else
-            error ("java_invoke: METHODNAME must be a string");
-        }
-      else
-        print_usage ();
-    }
-
-  return retval;
-}
-
 JNIEXPORT jboolean JNICALL
 Java_org_octave_Octave_call (JNIEnv *env, jclass, jstring funcName,
                              jobjectArray argin, jobjectArray argout)
@@ -1589,11 +1542,11 @@
         {
           octave_value_list ovl;
           count++;
-          ovl(0) = octave_value (this);
-          ovl(1) = (idx.front ())(0);
+          ovl(1) = octave_value (this);
+          ovl(0) = (idx.front ())(0);
           std::list<octave_value_list>::const_iterator it = idx.begin ();
           ovl.append (*++it);
-          retval = feval (std::string ("java_invoke"), ovl, 1);
+          retval = feval (std::string ("javaMethod"), ovl, 1);
           skip++;
         }
       else
@@ -1731,7 +1684,7 @@
 }
 
 octave_value
-octave_java::do_java_invoke (JNIEnv* jni_env, const std::string& name,
+octave_java::do_javaMethod (JNIEnv* jni_env, const std::string& name,
                              const octave_value_list& args)
 {
   octave_value retval;
@@ -1758,7 +1711,7 @@
 }
 
 octave_value
-octave_java:: do_java_invoke (JNIEnv* jni_env,
+octave_java:: do_javaMethod (JNIEnv* jni_env,
                               const std::string& class_name,
                               const std::string& name,
                               const octave_value_list& args)
@@ -1788,7 +1741,7 @@
 }
 
 octave_value
-octave_java::do_java_create (JNIEnv* jni_env, const std::string& name,
+octave_java::do_javaObject (JNIEnv* jni_env, const std::string& name,
                              const octave_value_list& args)
 {
   octave_value retval;
@@ -1937,13 +1890,14 @@
 @end group\n\
 @end example\n\
 \n\
-@seealso{java_invoke}\n\
+@seealso{javaMethod}\n\
 @end deftypefn")
 {
 #ifdef HAVE_JAVA
   octave_value retval;
 
   initialize_java ();
+
   if (! error_state)
     {
       JNIEnv *current_env = octave_java::thread_jni_env ();
@@ -1956,7 +1910,7 @@
               octave_value_list tmp;
               for (int i=1; i<args.length (); i++)
                 tmp(i-1) = args(i);
-              retval = octave_java::do_java_create (current_env, classname, tmp);
+              retval = octave_java::do_javaObject (current_env, classname, tmp);
             }
           else
             error ("javaObject: CLASSNAME argument must be a string");
@@ -1972,39 +1926,10 @@
 #endif
 }
 
-DEFUN (java_invoke, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {@var{ret} =} java_invoke (@var{obj}, @var{methodname}, @var{arg1}, @dots{})\n\
-Invoke the method @var{methodname} on the Java object @var{obj} with the arguments\n\
-@var{arg1}, @dots{}  For static methods, @var{obj} can be a string\n\
-representing the fully qualified name of the corresponding class.  The\n\
-function returns the result of the method invocation.\n\
-\n\
-When @var{obj} is a regular Java object, structure-like indexing can be\n\
-used as a shortcut syntax.  For instance, the two following statements are\n\
-equivalent\n\
-\n\
-@example\n\
-@group\n\
-  ret = java_invoke (x, \"method1\", 1.0, \"a string\")\n\
-  ret = x.method1 (1.0, \"a string\")\n\
-@end group\n\
-@end example\n\
-\n\
-@seealso{javaMethod, javaObject}\n\
-@end deftypefn")
-{
-#ifdef HAVE_JAVA
-  return _java_invoke (args);
-#else
-  error ("java_invoke: Octave was not compiled with Java interface");
-  return octave_value ();
-#endif
-}
-
 DEFUN (javaMethod, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {@var{ret} =} javaMethod (@var{methodname}, @var{obj}, @var{arg1}, @dots{})\n\
+@deftypefn  {Built-in Function} {@var{ret} =} javaMethod (@var{methodname}, @var{obj})\n\
+@deftypefnx {Built-in Function} {@var{ret} =} javaMethod (@var{methodname}, @var{obj}, @var{arg1}, @dots{})\n\
 Invoke the method @var{methodname} on the Java object @var{obj} with the arguments\n\
 @var{arg1}, @dots{}  For static methods, @var{obj} can be a string\n\
 representing the fully qualified name of the corresponding class.  The\n\
@@ -2021,28 +1946,45 @@
 @end group\n\
 @end example\n\
 \n\
-@seealso{java_invoke, javaObject}\n\
+@seealso{methods, javaObject}\n\
 @end deftypefn")
 {
 #ifdef HAVE_JAVA
   octave_value retval;
 
-  if (args.length () > 1)
+  initialize_java ();
+
+  if (! error_state)
     {
-      // swap first two arguments
-      octave_value_list tmp;
-      tmp(0) = args(1);
-      tmp(1) = args(0);
+      JNIEnv *current_env = octave_java::thread_jni_env ();
+
+      if (args.length () > 1)
+        {
+          std::string methodname = args(0).string_value ();
+          if (! error_state)
+            {
+              octave_value_list tmp;
+              for (int i=2; i<args.length (); i++)
+                tmp(i-2) = args(i);
 
-      // copy remaining arguments
-      for (int i=2; i<args.length (); i++)
-        tmp(i) = args(i);
-
-      retval = _java_invoke (tmp);
-    }
-  else
-    {
-      print_usage ();
+              if (args(1).class_name () == "octave_java")
+                {
+                  octave_java *jobj = TO_JAVA (args(1));
+                  retval = jobj->do_javaMethod (current_env, methodname, tmp);
+                }
+              else if (args(1).is_string ())
+                {
+                  std::string cls = args(1).string_value ();
+                  retval = octave_java::do_javaMethod (current_env, cls, methodname, tmp);
+                }
+              else
+                error ("javaMethod: OBJ must be a Java object or a string");
+            }
+          else
+            error ("javaMethod: METHODNAME must be a string");
+        }
+      else
+        print_usage ();
     }
 
   return retval;
@@ -2070,7 +2012,7 @@
 @end group\n\
 @end example\n\
 \n\
-@seealso{java_set, java_invoke, javaObject}\n\
+@seealso{__java_set__, javaMethod, javaObject}\n\
 @end deftypefn")
 {
 #ifdef HAVE_JAVA
@@ -2132,7 +2074,7 @@
 @end group\n\
 @end example\n\
 \n\
-@seealso{__java_get__, java_invoke, javaObject}\n\
+@seealso{__java_get__, javaMethod, javaObject}\n\
 @end deftypefn")
 {
 #ifdef HAVE_JAVA
@@ -2178,7 +2120,7 @@
 
 DEFUN (java2mat, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} java2mat (@var{obj})\n\
+@deftypefn {Built-in Function} {} java2mat (@var{javaobj})\n\
 Undocumented internal function.\n\
 @end deftypefn")
 {
@@ -2266,7 +2208,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} isjava (@var{x})\n\
 Return true if @var{x} is a Java object.\n\
-@seealso{class, typeinfo, isa}\n\
+@seealso{class, typeinfo, isa, javaObject}\n\
 @end deftypefn")
 {
   octave_value retval;
--- a/libinterp/octave-value/ov-java.h	Fri Dec 14 09:43:22 2012 -0800
+++ b/libinterp/octave-value/ov-java.h	Fri Dec 14 09:51:37 2012 -0800
@@ -198,34 +198,34 @@
 
   static JNIEnv* thread_jni_env (void);
 
-  octave_value do_java_invoke (JNIEnv* jni_env, const std::string& name,
-                               const octave_value_list& args);
+  octave_value do_javaMethod (JNIEnv* jni_env, const std::string& name,
+                              const octave_value_list& args);
 
   octave_value
-  do_java_invoke (const std::string& name, const octave_value_list& args)
+  do_javaMethod (const std::string& name, const octave_value_list& args)
   {
-    return do_java_invoke(thread_jni_env (), name, args);
+    return do_javaMethod(thread_jni_env (), name, args);
   }
 
   static octave_value
-  do_java_invoke (JNIEnv* jni_env, const std::string& class_name,
-                  const std::string& name, const octave_value_list& args);
+  do_javaMethod (JNIEnv* jni_env, const std::string& class_name,
+                 const std::string& name, const octave_value_list& args);
 
   static octave_value
-  do_java_invoke (const std::string& class_name, const std::string& name,
-                  const octave_value_list& args)
+  do_javaMethod (const std::string& class_name, const std::string& name,
+                 const octave_value_list& args)
   {
-    return do_java_invoke(thread_jni_env (), class_name, name, args);
+    return do_javaMethod(thread_jni_env (), class_name, name, args);
   }
 
   static octave_value
-  do_java_create (JNIEnv* jni_env, const std::string& name,
-                  const octave_value_list& args);
+  do_javaObject (JNIEnv* jni_env, const std::string& name,
+                 const octave_value_list& args);
 
   static octave_value
-  do_java_create (const std::string& name, const octave_value_list& args)
+  do_javaObject (const std::string& name, const octave_value_list& args)
   {
-    return do_java_create (thread_jni_env (), name, args);
+    return do_javaObject (thread_jni_env (), name, args);
   }
 
   octave_value do_java_get (JNIEnv* jni_env, const std::string& name);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/java_invoke.m	Fri Dec 14 09:51:37 2012 -0800
@@ -0,0 +1,57 @@
+## Copyright (C) 2007 Michael Goffioul
+##
+## 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
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Built-in Function} {@var{ret} =} java_invoke (@var{obj}, @var{methodname})
+## @deftypefnx {Built-in Function} {@var{ret} =} java_invoke (@var{obj}, @var{methodname}, @var{arg1}, @dots{})
+## Invoke the method @var{methodname} on the Java object @var{obj} with the
+## arguments @var{arg1}, @dots{}  For static methods, @var{obj} can be a
+## string representing the fully qualified name of the corresponding class. 
+## The function returns the result of the method invocation.
+## 
+## When @var{obj} is a regular Java object, structure-like indexing can be
+## used as a shortcut syntax.  For instance, the two following statements are
+## equivalent
+## 
+## @example
+## @group
+##   ret = java_invoke (x, \"method1\", 1.0, \"a string\")
+##   ret = x.method1 (1.0, \"a string\")
+## @end group
+## @end example
+## 
+## @seealso{javaMethod, javaObject}
+## @end deftypefn
+
+function retval = java_invoke (obj, methodname, varargin)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "java_invoke is obsolete and will be removed from a future version of Octave, please use javaMethod instead");
+  endif
+  
+  if (nargin < 2)
+    print_usage ();
+  endif
+
+  retval = javaMethod (methodname, obj, varargin);
+
+endfunction
+
--- a/scripts/deprecated/javafields.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/deprecated/javafields.m	Fri Dec 14 09:51:37 2012 -0800
@@ -23,7 +23,7 @@
 ## Return the fields of a Java object or Java class in the form of a cell 
 ## array of strings.  If no output is requested, print the result
 ## to the standard output.
-## @seealso{fieldnames, methods, javamethods, javaObject}
+## @seealso{fieldnames, methods, javaObject}
 ## @end deftypefn
 
 function fld_names = javafields (javaobj)
@@ -39,7 +39,7 @@
     print_usage ();
   endif
   
-  c_methods = java_invoke ("org.octave.ClassHelper", "getFields", javaobj);
+  c_methods = javaMethod ("getFields", "org.octave.ClassHelper", javaobj);
   method_list = strsplit (c_methods, ';');
 
   if (nargout == 0)
--- a/scripts/deprecated/javamethods.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/deprecated/javamethods.m	Fri Dec 14 09:51:37 2012 -0800
@@ -23,7 +23,7 @@
 ## Return the methods of a Java object or Java class in the form of a cell 
 ## array of strings.  If no output is requested, print the result to the
 ## standard output.
-## @seealso{methods, javafields, java_invoke, javaMethod, javaObject}
+## @seealso{methods, fieldnames, javaMethod, javaObject}
 ## @end deftypefn
 
 function mtd_names = javamethods (classname)
@@ -39,7 +39,7 @@
     print_usage ();
   endif
 
-  cls_methods = java_invoke ("org.octave.ClassHelper", "getMethods", classname);
+  cls_methods = javaMethod ("getMethods", "org.octave.ClassHelper", classname);
   method_list = strsplit (cls_methods, ';');
 
   if (nargout == 0)
--- a/scripts/deprecated/module.mk	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/deprecated/module.mk	Fri Dec 14 09:51:37 2012 -0800
@@ -8,6 +8,7 @@
   deprecated/error_text.m \
   deprecated/isstr.m \
   deprecated/java_get.m \
+  deprecated/java_invoke.m \
   deprecated/java_new.m \
   deprecated/java_set.m \
   deprecated/javafields.m \
--- a/scripts/general/fieldnames.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/general/fieldnames.m	Fri Dec 14 09:51:37 2012 -0800
@@ -46,7 +46,7 @@
     ## Call internal C++ function for structs or Octave objects
     names = __fieldnames__ (obj);
   elseif (isjava (obj) || ischar (obj))
-    names_str = java_invoke ("org.octave.ClassHelper", "getFields", obj);
+    names_str = javaMethod ("getFields", "org.octave.ClassHelper", obj);
     names = strsplit (names_str, ';');
   else
     error ("fieldnames: Invalid input argument"); 
--- a/scripts/general/methods.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/general/methods.m	Fri Dec 14 09:51:37 2012 -0800
@@ -42,11 +42,11 @@
     ## Try Octave class first.
     mtds_list = __methods__ (obj);
     if (isempty (mtds_list))
-      mtds_str = java_invoke ("org.octave.ClassHelper", "getMethods", obj);
+      mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj);
       mtds_list = strsplit (mtds_str, ';');
     endif
   elseif (isjava (obj))
-    mtds_str = java_invoke ("org.octave.ClassHelper", "getMethods", obj);
+    mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj);
     mtds_list = strsplit (mtds_str, ';');
   else
     error ("methods: Invalid input argument");
--- a/scripts/java/errordlg.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/errordlg.m	Fri Dec 14 09:51:37 2012 -0800
@@ -49,7 +49,7 @@
     error ("errordlg: TITLE must be a character string");
   endif
 
-  h = java_invoke ("org.octave.JDialogBox", "errordlg", msg, title);
+  h = javaMethod ("errordlg", "org.octave.JDialogBox", msg, title);
 
 endfunction
 
--- a/scripts/java/helpdlg.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/helpdlg.m	Fri Dec 14 09:51:37 2012 -0800
@@ -49,7 +49,7 @@
     error ("helpdlg: TITLE must be a character string");
   endif
 
-  h = java_invoke ("org.octave.JDialogBox", "helpdlg", msg, title);
+  h = javaMethod ("helpdlg", "org.octave.JDialogBox", msg, title);
 
 endfunction
 
--- a/scripts/java/inputdlg.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/inputdlg.m	Fri Dec 14 09:51:37 2012 -0800
@@ -126,7 +126,7 @@
   defs = cellfun (@num2str, defaults, "UniformOutput", false);
   rc = arrayfun (@num2str, rowscols, "UniformOutput", false);
 
-  user_inputs = java_invoke ("org.octave.JDialogBox", "inputdlg",
+  user_inputs = javaMethod ("inputdlg", "org.octave.JDialogBox",
                              prompt, title, rc, defs);
   
    if (isempty (user_inputs))
--- a/scripts/java/javaArray.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/javaArray.m	Fri Dec 14 09:51:37 2012 -0800
@@ -44,7 +44,7 @@
     print_usage ();
   endif
 
-  retval = java_invoke ("org.octave.ClassHelper", "createArray",
+  retval = javaMethod ("createArray", "org.octave.ClassHelper",
                         classname, [varargin{:}]);
 
 endfunction
--- a/scripts/java/javaaddpath.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/javaaddpath.m	Fri Dec 14 09:51:37 2012 -0800
@@ -48,7 +48,7 @@
       error ("javaaddpath: CLSPATH does not exist: %s", clspath);
     endif
 
-    success = java_invoke ("org.octave.ClassHelper", "addClassPath", new_path);
+    success = javaMethod ("addClassPath", "org.octave.ClassHelper", new_path);
 
     if (! success)
       warning ("javaaddpath: failed to add '%s' to Java classpath", new_path);
--- a/scripts/java/javaclasspath.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/javaclasspath.m	Fri Dec 14 09:51:37 2012 -0800
@@ -57,11 +57,11 @@
 function varargout = javaclasspath (which)
 
   ## dynamic classpath
-  dynamic_path = java_invoke ("org.octave.ClassHelper", "getClassPath");
+  dynamic_path = javaMethod ("getClassPath", "org.octave.ClassHelper");
   dynamic_path_list = strsplit (dynamic_path, pathsep ());
 
   ## static classpath
-  static_path = java_invoke ("java.lang.System", "getProperty", "java.class.path");
+  static_path = javaMethod ("getProperty", "java.lang.System", "java.class.path");
   static_path_list = strsplit (static_path, pathsep ());
   if (numel (static_path_list) > 1)
     ## remove first element (which is .../octave.jar)
--- a/scripts/java/javamem.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/javamem.m	Fri Dec 14 09:51:37 2012 -0800
@@ -67,7 +67,7 @@
 
 function jmem = javamem ()
 
-  rt = java_invoke ("java.lang.Runtime", "getRuntime");
+  rt = javaMethod ("getRuntime", "java.lang.Runtime");
   rt.gc;
   jvmem = cell (3, 1);
   jvmem{1} = rt.maxMemory ().doubleValue ();
--- a/scripts/java/javarmpath.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/javarmpath.m	Fri Dec 14 09:51:37 2012 -0800
@@ -46,7 +46,7 @@
       endif
     endif
 
-    success = java_invoke ("org.octave.ClassHelper", "removeClassPath",
+    success = javaMethod ("removeClassPath", "org.octave.ClassHelper",
                            old_path);
 
     if (! success)
--- a/scripts/java/listdlg.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/listdlg.m	Fri Dec 14 09:51:37 2012 -0800
@@ -128,7 +128,7 @@
    listsize = {num2str(listsize(2)), num2str(listsize(1))};
    initialvalue = arrayfun (@num2str, initialvalue, "UniformOutput", false);
    
-   ret = java_invoke ("org.octave.JDialogBox", "listdlg", listcell,
+   ret = javaMethod ("listdlg", "org.octave.JDialogBox", listcell,
                       selmode, listsize, initialvalue, name, prompt,
                       okstring, cancelstring);
 
--- a/scripts/java/msgbox.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/msgbox.m	Fri Dec 14 09:51:37 2012 -0800
@@ -70,7 +70,7 @@
     endswitch
   endif
 
-  h = java_invoke ("org.octave.JDialogBox", dlg, msg, title);
+  h = javaMethod (dlg, "org.octave.JDialogBox", msg, title);
 
 endfunction
 
--- a/scripts/java/questdlg.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/questdlg.m	Fri Dec 14 09:51:37 2012 -0800
@@ -94,7 +94,7 @@
 
   endswitch
 
-  btn = java_invoke ("org.octave.JDialogBox", "questdlg", msg,
+  btn = javaMethod ("questdlg", "org.octave.JDialogBox", msg,
                      title, options);
 
 endfunction
--- a/scripts/java/warndlg.m	Fri Dec 14 09:43:22 2012 -0800
+++ b/scripts/java/warndlg.m	Fri Dec 14 09:51:37 2012 -0800
@@ -48,7 +48,7 @@
     error ("warndlg: TITLE must be a character string");
   endif
 
-  retval = java_invoke ("org.octave.JDialogBox", "warndlg", msg, title);
+  retval = javaMethod ("warndlg", "org.octave.JDialogBox", msg, title);
 
 endfunction