bugGNU Octave - Bugs: bug #48758, methods with java.lang.String...

 
 

bug #48758: methods with java.lang.String argument should return methods of String class

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Thu 11 Aug 2016 02:23:29 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Matlab Compatibility
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
   

Thu 21 Mar 2019 01:24:46 AM UTC, comment #3: 

This is fixed on the default branch along with a test case to make sure it works as expected

https://hg.savannah.gnu.org/hgweb/octave/rev/0ffbc690b493

Mike Miller <mtmiller>
Group Member
Fri 22 Feb 2019 01:22:33 AM UTC, comment #2: 

The attached patch no longer applies to the default branch. There have been other changes recently to the "methods" function, maybe this can be fixed easily now as well, taking care of the "FIXME" comment.

Example:


methods (javaObject ("java.lang.String", "java.lang.Double"))


should return the same as


methods ("java.lang.String")


not the same as


methods ("java.lang.Double")


IOW, the argument should be interpreted as an instance of the class java.lang.String, not as a string naming a class to check.

Mike Miller <mtmiller>
Group Member
Fri 12 Aug 2016 12:09:13 AM UTC, comment #1: 

Fixed and tested.

(file #38185)

Ernst Reissner <ernstreissner>
Thu 11 Aug 2016 02:23:29 PM UTC, original submission:  

in files fieldnames.m and methods.m
there is a FIXME comment, 
   ## FIXME: Function prototype accepts java obj, but doesn't work if obj
    ##        is e.g., java.lang.String.  Convert obj to classname then.


and

   ## FIXME: Function prototype that excepts java obj exists, but doesn't
    ##        work if obj is java.lang.String.  Convert obj to classname.
 

This is due to a misunderstanding.
According to

http://de.mathworks.com/help/matlab/ref/methods.html?searchHighlight=methods
http://de.mathworks.com/help/matlab/ref/fieldnames.html,

for java objects the fields and methods shall be returned.
This applies in particular for class java.lang.String.
The String value is not interpreted as classname!!!

Thus with str=javaObject('java.lang.String', 'java.math.BigDecimal')

fieldnames(str)
returns the fields of String not of BigDecimal.
This is correct.

But methods(str) returns the methods of BigDecimal
instead of String.

Ernst Reissner <ernstreissner>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38185:  patchBug48758.patch added by ernstreissner (4KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-21 mtmiller StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2019-02-22 mtmiller Carbon-CopyRemoved 80942 -
    2019-02-22 mtmiller Severity3 - Normal 1 - Wish
        StatusPatch Submitted Confirmed
        Summarymethods(java.lang.String) methods with java.lang.String argument should return methods of String class
    2016-11-18 mtmiller CategoryNone Octave Function
        Item GroupNone Matlab Compatibility
        StatusNone Patch Submitted
    2016-08-12 ernstreissner Attached File- Added patchBug48758.patch, #38185
    2016-08-11 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code