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

 
 

bug #48738: java array length

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Tue 09 Aug 2016 08:26:15 PM UTC  
 
Category: LibrariesSeverity: 1 - Wish
Priority: 5 - NormalItem Group: Feature Request
Status: Need InfoAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project Administrator
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 File(s):
   
   
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
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by ernstreissner (Submitted the item)
  • -unavailable- added by ernstreissner
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 19 Aug 2016 09:45:32 AM UTCernstreissnerAttached File-=>Added patchBug48738B.patch, #38273
    Fri 19 Aug 2016 09:38:00 AM UTCernstreissnerAttached File-=>Added patchBug48738.patch, #38272
    Wed 10 Aug 2016 01:16:38 AM UTCmtmillerCategoryNone=>Libraries
      Severity3 - Normal=>1 - Wish
      Item GroupNone=>Feature Request
      StatusNone=>Need Info
    Tue 09 Aug 2016 08:26:15 PM UTCernstreissnerCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1