bugGNU Octave - Bugs: bug #55858, methods() does not include...

 
 

bug #55858: methods() does not include constructors

Submitter:  Mike Miller <mtmiller>
Submitted:  Thu 07 Mar 2019 11:36:51 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 25 Mar 2019 09:03:54 PM UTC, comment #8: 

I added input validation of the second option argument here (https://hg.savannah.gnu.org/hgweb/octave/rev/aa50801747a9).  I think this bug is now resolved.  Closing report.

Rik <rik5>
Group administrator
Wed 20 Mar 2019 08:32:26 PM UTC, comment #7: 

One more fix, this works now with local Java classes (not in a package)

https://hg.savannah.gnu.org/hgweb/octave/rev/7f86c097f29e

Mike Miller <mtmiller>
Group Member
Wed 20 Mar 2019 06:32:43 PM UTC, comment #6: 

I only tested my regexp changes on classes that are declared in packages. I have not tested any local classes that are not package-scoped. It's possible the regexps will fail on bare package names, I'll test that if I get a moment.

Mike Miller <mtmiller>
Group Member
Wed 20 Mar 2019 06:27:04 PM UTC, comment #5: 

That works for me, but the overloads should not be shown without the '-full' option. I made some additions to the regexp post-processing that is being done on the methods list

https://hg.savannah.gnu.org/hgweb/octave/rev/6e01e5be8de3

This looks right to me now, both with and without the "-full" option.

Anything else need to be done here?

Mike Miller <mtmiller>
Group Member
Wed 20 Mar 2019 05:37:12 PM UTC, comment #4: 

OK, I found how to get the list of Java constructors.  The following patch works for me, but also includes returns fully-qualified names, so, for example, it displays "java.lang.String" instead of just "String".

http://hg.savannah.gnu.org/hgweb/octave/rev/ca8c2696af62

John W. Eaton <jwe>
Group administrator
Wed 20 Mar 2019 05:03:04 PM UTC, comment #3: 

Here's a Matlab example (excerpt)


>> methods ('java.lang.String', '-full')

Methods for class java.lang.String:

String(byte[],java.nio.charset.Charset)
String(byte[],int,int)
String(byte[],int,int,int)
String(byte[],int)
String(char[],int,int)
String(java.lang.String)
String(char[])
String()


Mike Miller <mtmiller>
Group Member
Wed 20 Mar 2019 05:00:10 PM UTC, comment #2: 

Yes, as I said in comment #0

> With the "-full" option, all overloaded constructors should be returned for Java classes.


Maybe we need to add proper support for this in org.octave.ClassHelper.

Mike Miller <mtmiller>
Group Member
Wed 20 Mar 2019 04:46:27 PM UTC, comment #1: 

I pushed the following changeset for classdef.  I'm not sure how to properly fix the output for Java classes.  Should we just insert the name of the class in the list (I suppose I could have done that for classdef as well)?  What about for the "-full" output?  Does Matlab show multiple constructor signatures (if there is more than one)?  Where does it get the list?

http://hg.savannah.gnu.org/hgweb/octave/rev/fbb318c371db

John W. Eaton <jwe>
Group administrator
Thu 07 Mar 2019 11:36:51 PM UTC, original submission:  

The methods() function should include class constructors in the list of method names. This applies both to classdef classes and to Java classes. The constructor name is returned without any Matlab or Java package prefix, just the bare name (e.g. "String" instead of "java.lang.String", or "Map" instead of "containers.Map").

With the "-full" option, all overloaded constructors should be returned for Java classes. No return type is listed for Java constructors.

It looks to me like the constructor name is sorted (in ASCII sort order, where all capitals come before lowercase) along with other methods. In Java classes, since methods typically start with a lowercase, this means the uppercase constructor name comes first in the list. In classdef classes, the constructor name is sorted and appears within the list of other method names.

Mike Miller <mtmiller>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-25 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-03-20 mtmiller StatusConfirmed Ready For Test
    2019-03-07 mtmiller Carbon-CopyRemoved 80942 -

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code