Mercurial > hg > octave-lojdl
changeset 15816:59b6c6aee042
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.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 18 Dec 2012 11:54:57 -0800 |
parents | f28b3dcbaa9a |
children | dbb7896f15c7 |
files | libinterp/octave-value/ov-java.cc scripts/general/fieldnames.m scripts/general/methods.m |
diffstat | 3 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-java.cc +++ b/libinterp/octave-value/ov-java.cc @@ -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); }
--- a/scripts/general/fieldnames.m +++ b/scripts/general/fieldnames.m @@ -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
--- a/scripts/general/methods.m +++ b/scripts/general/methods.m @@ -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