[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #39073] java_get wrong return type
From: |
Ernst Reissner |
Subject: |
[Octave-bug-tracker] [bug #39073] java_get wrong return type |
Date: |
Sun, 26 May 2013 22:54:01 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 |
Follow-up Comment #3, bug #39073 (project octave):
yes
++++
www.mathworks.de/de/help/matlab/matlab_external/handling-data-returned-from-a-java-method.html#bqgs4dc
----
seems really valuable.
I cite:
<cite>
Java Objects
When a method call returns Java objects, MATLAB leaves them in their original
form. They remain as Java objects so you can continue to use them to interact
with other Java methods.
The only exception to this is when the method returns data of type
java.lang.Object.
</cite>
So this means that auto(un)boxing of RETURN VALUES
is not conform with matlab.
Of course, object means really a subclass of java.lang.Object.
Not to mix up with using the method double
<cite>
Converting to the MATLAB double Type
Using the double function in MATLAB, you can convert any Java object or array
of objects to the MATLAB double type. The action taken by the double function
depends on the class of the object you specify:
If the object is an instance of a numeric class (java.lang.Number or one of
the classes that inherit from that class), MATLAB uses a preset conversion
algorithm to convert the object to a MATLAB double.
If the object is not an instance of a numeric class, MATLAB checks the class
definition to see if it implements a method called toDouble. MATLAB uses
toDouble to perform its conversion of Java objects to the MATLAB double type.
If such a method is implemented for this class, MATLAB executes it to perform
the conversion.
.....
</cite>
In by case i have the problem with a class extending java.lang.Number.
I have the impression that the method double is invoked
to convert, which is not allowed.
By the way, i do not define method toDouble.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39073>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/