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 Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  4.2.2 Operating 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 Files:

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 adaerr (Submitted the item)

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

    Only project members can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.3