bugGNU Octave - Bugs: bug #48738, java array length

 
 

bug #48738: java array length

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Tue 09 Aug 2016 08:26:15 PM UTC
   
 
Category:  Libraries Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Need Info Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 19 Aug 2016 09:45:32 AM UTC, comment #3: 

ok, now I found some improvement and real fix.

(file #38273)

Ernst Reissner <ernstreissner>
Fri 19 Aug 2016 09:38:00 AM UTC, comment #2: 

Actually, I did not find one.
Nevertheless, I think .length is convenient.
It is not a bug but maybe a wish.

commenting your suggestions:
- size is not the same, it displays two dimensions
- for java arrays, both length(.) and numel(.) are the same
  but this is true only because java arrays are seen as 1 dimensional in octave and nested arrays are not visible.

I attached a patch, you could apply because it improves the implementation, documents further weaknesses
and provides in comments 2 lines fix for 'bug' 48738

(file #38272)

Ernst Reissner <ernstreissner>
Wed 10 Aug 2016 01:16:38 AM UTC, comment #1: 

Can you cite a reference that shows that the ".length" property is supported in Matlab's Java syntax? The Octave equivalent that already works currently would be to use either length(a), numel(a), or size(a). Those are the only documented ways to get the size that I can find on Matlab's public docs.

Mike Miller <mtmiller>
Group Member
Tue 09 Aug 2016 08:26:15 PM UTC, original submission:  

The length of a java array shall be returned using the length attribute:

a=javaArray('java.lang.Object',1,2);a=a(1)

yields (this is a little more complex because of another bug):

a =
<Java object: java.lang.Object[]>

Then we would expect a.length
to return

ans =
2

but obtain
error: [java] java.lang.NoSuchFieldException: length

As a field is expected as for non-array objects.

Suggestion for a bugfix is to add also method is_java_array.

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 #38273:  patchBug48738B.patch added by ernstreissner (1KiB - text/x-patch)
file #38272:  patchBug48738.patch added by ernstreissner (10KiB - 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 mtmiller (Posted a comment)
  • -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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-19 ernstreissner Attached File- Added patchBug48738B.patch, #38273
    2016-08-19 ernstreissner Attached File- Added patchBug48738.patch, #38272
    2016-08-10 mtmiller CategoryNone Libraries
        Severity3 - Normal 1 - Wish
        Item GroupNone Feature Request
        StatusNone Need Info
    2016-08-09 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code