Marking as fixed and closing report.

The problem with Java methods should be fixed with the following changeset:
http://hg.savannah.gnu.org/hgweb/octave/rev/8554becefe1b
I also added some tests for ismethod:
http://hg.savannah.gnu.org/hgweb/octave/rev/c4e53014f248
Is there anything else that needs to be done here?

See bug #48742 for Java 'methods(obj)' and 'methods(obj, "full")'.

Yes, seems like it would be a good idea to implement 'full' for methods(). Also, I notice that Matlab returns a column vector rather than a row vector of function names. Maybe that doesn't matter so much, but it would be easy to change. Finally, methods() on java.lang.String returns 91 methods in Matlab and only 76 in Octave. In Matlab, first all constructors are returned. After that, methods are returned in alphabetical order. In Octave, the methods are returned in some higgledypiggledy order.

Oops, comment #5 should have been
Hmm, if you do
you'll see that the list of methods includes type information. So the simple ismember check on the result returned by methods doesn't work to match
'hashCode'.
Also, the Matlab docs say that methods with the 'full' option will return type signature info for Java and Matlab methods.
So I guess we should strip the type info from the output of methods unless the option 'full' is supplied?

Looks like the comment was cut off because the verbatim tag was misspelled.
In any case, I tried in Matlab and methods() returns only the function name. It does not return the output type, nor does it include the extra parentheses '()'.
Either we change how methods() returns data from Java objects, or if we like the extra verbosity about the function, then we have to change ismethod to possibly use a regular expression to remove extraneous information.
This regexp would work
Of course, this leaves duplicates in the list of methods. But that doesn't really matter because you could then use
rather than
This will probably be faster because ismember is rather slow.

Hmm, if you do

In answer to comment #2, yes, Matlab allows ismethod on Java objects. The following returns true in Matlab:
Octave still returns false for the example code above.
On the positive side, ismethod in Octave now works correctly for classdef objects and for the original code in this report.

I pushed the following changeset:
http://hg.savannah.gnu.org/hgweb/octave/rev/9cadeae949f2

In Matlab, does ismethod also work for Java objects?

Confirmed. Adding jwe to the CC list since he has just been working on the methods() function for classes.
With the test code in this bug report, calling methods ('testclass') returns the class method "getNumber". So, to some extent, Octave knows about the method. But ismethod returns false.

Having the following classdef in file testclass.m:
The ismethod() function (if I understood it correctly from the matlab documentation) should return true, if the class or object given as first parameter has a public method with the name given as second parameter. So the following calls to ismethod should return true:
But they return false.
