Mercurial > octave-nkf
comparison scripts/general/methods.m @ 20601:5d31cd795c21 stable
methods.m: try Java class names if getMethods fails on Java objects (bug #46010)
author | Philip Nienhuis <prnienhuis@users.sf.net> |
---|---|
date | Fri, 02 Oct 2015 17:44:53 +0200 |
parents | 7503499a252b |
children |
comparison
equal
deleted
inserted
replaced
20600:1d6ab08edcde | 20601:5d31cd795c21 |
---|---|
45 if (isempty (mtds_list)) | 45 if (isempty (mtds_list)) |
46 mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); | 46 mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); |
47 mtds_list = ostrsplit (mtds_str, ';'); | 47 mtds_list = ostrsplit (mtds_str, ';'); |
48 endif | 48 endif |
49 elseif (isjava (obj)) | 49 elseif (isjava (obj)) |
50 ## FIXME: Function prototype that excepts java obj exists, but doesn't | 50 ## FIXME: Function prototype accepts java obj, but doesn't work if obj |
51 ## work if obj is java.lang.String. Convert obj to classname. | 51 ## is e.g., java.lang.String. Convert obj to classname then. |
52 obj = class (obj); | 52 try |
53 mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); | 53 mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); |
54 catch | |
55 obj = class (obj); | |
56 mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj); | |
57 end_try_catch | |
54 mtds_list = strsplit (mtds_str, ';'); | 58 mtds_list = strsplit (mtds_str, ';'); |
55 else | 59 else |
56 error ("methods: Invalid input argument"); | 60 error ("methods: Invalid input argument"); |
57 endif | 61 endif |
58 | 62 |