bugGNU Octave - Bugs: bug #46200, octave automatically converts java...

 
 

bug #46200: octave automatically converts java strings into char arrays

Submitted by:  Carnë Draug <carandraug>
Submitted on:  Tue 13 Oct 2015 12:51:00 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Duplicate Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 27 Jun 2018 10:01:11 AM UTC, comment #3:

This seems to be a duplicate of bug #42701.

Markus Mützel <mmuetzel>
Project Member
Tue 13 Oct 2015 08:05:22 PM UTC, comment #2:

This afternoon I did just that, and indeed in your first example the result remains to be a Java object.

ML r2014a says about your second example (copied by typing over as I can't copy/paste from remote desktop):

Philip Nienhuis <philipnienhuis>
Project Member
Tue 13 Oct 2015 03:29:15 PM UTC, comment #1:

Need someone with Matlab and some tests cases. I think there may be a distinction between returning the generic javaObject class, which then gets queried by Matlab and converted if necessary, and returning a specific object from a given class.

Otherwise, you it would be next to impossible to actually create a java.lang.String object because it would always be auto-converted.

As an example, what does Matlab do for

My guess is that this remains an object, not converted to char.

On the other hand, the following code does do auto-conversion. Presumably, because a Java array is an array of the generic java.lang.Object type

Rik <rik5>
Project Administrator
Tue 13 Oct 2015 12:51:00 PM UTC, original submission:

Octave automatically converts specific java objects into Octave data types as Matlab supposedly does. This includes converting a java.lang.String into a char array. According to Matlab documentation http://uk.mathworks.com/help/matlab/matlab_external/handling-data-returned-from-a-java-method.html#f61197

> When a method call returns data of type java.lang.Object, MATLAB converts its value, depending on its actual type, according to the following table.


However, it seems that our interpretation of Matlab documentation was incorrect (see https://github.com/openmicroscopy/bioformats/pull/2017#discussion_r41634730 for the origin of this)

Could it be that Matlab documentation meant that it performs an implicit conversion to char when required and not as soon as the java method returns? I don't know what's the way to Matlab compatibility.

Carnë Draug <carandraug>
Project Member

 

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

Attach Files:
   
   
Comment:
   

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 mmuetzel (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by carandraug (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.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-27 mmuetzel StatusNone => Duplicate
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.3