octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53524] Java: cannot call method requiring arr


From: Adrian
Subject: [Octave-bug-tracker] [bug #53524] Java: cannot call method requiring array argument with single-element-array
Date: Fri, 30 Mar 2018 07:38:30 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

URL:
  <http://savannah.gnu.org/bugs/?53524>

                 Summary: Java: cannot call method requiring array argument
with single-element-array
                 Project: GNU Octave
            Submitted by: 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: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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


javaMethod("foo",object,vector);


octave throws an


error: [java] java.lang.NoSuchMethodException: foo


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
<https://savannah.gnu.org/bugs/?func=detailitem&item_id=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
<https://savannah.gnu.org/bugs/?func=detailitem&item_id=48591>) instead of
relying on auto(un)boxing.

I have no idea how Matlab behaves in this regard.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53524>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]