bugGNU Octave - Bugs: bug #42701, java toString method returns char...

 
 

bug #42701: java toString method returns char instead of java.lang.String

Submitted by:  Carnë Draug <carandraug>
Submitted on:  Mon 07 Jul 2014 09:49:25 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Need InfoAssigned to: None
Originator Name: Open/Closed: Open
Release: 3.8.1Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Thu 10 Jul 2014 11:56:18 AM UTC, comment #3:

I just asked on IRC, and on Matlab R2014a happens the same:

Carnë Draug <carandraug>
Project Member
Thu 10 Jul 2014 11:13:02 AM UTC, comment #2:

I tested with Matlab R2010b. Yes, the documentation does suggest that but then, the following documentation on the same page:

> With the MATLAB char function, you can convert java.lang.String
> objects and arrays to MATLAB character arrays.


does not make a lot of sense. Why are they writing about calling char() on a java.lang.String if that an object cannot exist (it is automatically converted to char)?

This is very much against their documentation. I just tried your second example:

Carnë Draug <carandraug>
Project Member
Thu 10 Jul 2014 01:18:58 AM UTC, comment #1:

Hmm, this seems to directly contradict Matlab's own documentation. At http://www.mathworks.com/help/matlab/matlab_external/handling-data-returned-from-a-java-method.html#f61197 they explicitly say

> 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.


and says that a Java return value of java.lang.String should be auto-converted into a Matlab type char value. Unless I'm completely misunderstanding that page. What version of Matlab did you observe this in? Any different result with

Mike Miller <mtmiller>
Project Member
Mon 07 Jul 2014 09:49:25 PM UTC, original submission:

Java objects have a "toString" which returns a java.lang.String object. However, calling this method via Octave returns an Octave char. Example:

while in Matlab:

Carnë Draug <carandraug>
Project Member

 

(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 mtmiller (Posted a comment)
  • -unavailable- added by carandraug (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):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 10 Jul 2014 01:18:58 AM UTCmtmillerCategoryNone=>Libraries
      Item GroupNone=>Matlab Compatibility
      StatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup