bugGNU Octave - Bugs: bug #53524, Java: cannot call method requiring...

 
 

bug #53524: Java: cannot call method requiring array argument with single-element-array

Submitted by:  Adrian <adaerr>
Submitted on:  Fri 30 Mar 2018 11:38:28 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Unexpected Error
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: 4.2.2Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 30 Mar 2018 11:58:45 AM UTC, comment #1:

Forgot to suggest that the conversion could be made wider to accept converting an octave scalar double to a Java primitive int[] array for the purpose of matching a method argument type.

Adrian <adaerr>
Fri 30 Mar 2018 11:38:28 AM UTC, original submission:

When calling a java object's method foo(int[] array) via

octave throws an

when the parameter vector (an octave double array of size (N,1)) has a single element (N=1). I guess this is because 'vector' in that case is a simple scalar, and being of type double is not cast to an array. However it is on one hand side unexpected that the case N=1 should behave differently from N>1 and make the script fail, and on the other hand side I see no work-around to call that method with a single-element-array as required.

I will bump bug #48790 which, if solved, would provide a work-around by explicitely creating a single element java array (currently the resulting array is immediately converted into an octave scalar).

Another solution would be to be able to provide conversion hints explicitely (as is possible in the opposite direction java->octave by applying e.g. function double on java objects #48591) instead of relying on auto(un)boxing.

I have no idea how Matlab behaves in this regard.

Adrian <adaerr>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by adaerr (Submitted the item)
  •  

    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):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1