# HG changeset patch # User Rik # Date 1355860497 28800 # Node ID 59b6c6aee0426b6486e00d909e1a00af51179acc # Parent f28b3dcbaa9ad6c5819740f7ddd04f7871ff1374 Don't box return values from javaObject. Always return a Java object. * libinterp/octave-value/ov-java.cc(do_javaObject): Don't call box() on newly created Java object. * scripts/general/fieldnames.m: Work-around bug with java.lang.String objects by calling getFields with class name rather than object. * scripts/general/methods.m: Work-around bug with java.lang.String objects by calling getMethods with class name rather than object. diff -r f28b3dcbaa9a -r 59b6c6aee042 libinterp/octave-value/ov-java.cc --- a/libinterp/octave-value/ov-java.cc Tue Dec 18 11:39:24 2012 -0800 +++ b/libinterp/octave-value/ov-java.cc Tue Dec 18 11:54:57 2012 -0800 @@ -1793,7 +1793,7 @@ jstring (clsName), jobjectArray (arg_objs), jobjectArray (arg_types))); if (resObj) - retval = box (jni_env, resObj); + retval = octave_value (new octave_java (resObj, 0)); else check_exception (jni_env); } diff -r f28b3dcbaa9a -r 59b6c6aee042 scripts/general/fieldnames.m --- a/scripts/general/fieldnames.m Tue Dec 18 11:39:24 2012 -0800 +++ b/scripts/general/fieldnames.m Tue Dec 18 11:54:57 2012 -0800 @@ -46,6 +46,11 @@ ## Call internal C++ function for structs or Octave objects names = __fieldnames__ (obj); elseif (isjava (obj) || ischar (obj)) + ## FIXME: Function prototype that excepts java obj exists, but doesn't + ## work if obj is java.lang.String. Convert obj to classname. + if (! ischar (obj)) + obj = class (obj); + endif names_str = javaMethod ("getFields", "org.octave.ClassHelper", obj); names = strsplit (names_str, ';'); else diff -r f28b3dcbaa9a -r 59b6c6aee042 scripts/general/methods.m --- a/scripts/general/methods.m Tue Dec 18 11:39:24 2012 -0800 +++ b/scripts/general/methods.m Tue Dec 18 11:54:57 2012 -0800 @@ -46,6 +46,9 @@ mtds_list = strsplit (mtds_str, ';'); endif elseif (isjava (obj)) + ## FIXME: Function prototype that excepts java obj exists, but doesn't + ## work if obj is java.lang.String. Convert obj to classname. + obj = class (obj); mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); mtds_list = strsplit (mtds_str, ';'); else