bugGNU Octave - Bugs: bug #50358, Document that no null java object...

 
 

bug #50358: Document that no null java object exists

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Mon 20 Feb 2017 09:54:13 AM UTC  
 
Category: DocumentationSeverity: 2 - Minor
Priority: 3 - LowItem Group: Documentation
Status: NoneAssigned to: None
Originator Name: Ernst ReissnerOpen/Closed: Open
Release: 4.2.0Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 20 Feb 2017 06:45:09 PM UTC, comment #4:

As Carnë said, for Matlab compatibility, any Java null reference must be converted to an empty array and it must be of type double. This has been worked out before, but can be tested again in a current version of Matlab if confirmation is needed.

The Matlab compatible way to test for a "null" return value from a Java method is to test that both isempty(x) and isnumeric(x) are true (see http://www.mathworks.com/matlabcentral/newsreader/view_thread/53512 for example).

Mike Miller <mtmiller>
Project Administrator
Mon 20 Feb 2017 05:00:53 PM UTC, comment #3:

I just wonder, whether it is possible to represent null as [] of octave_java type.
If not, then it is clear, that isjava([]) returns false.
But yes, i feel, this is worth mentioning.

Ernst Reissner <ernstreissner>
Mon 20 Feb 2017 03:41:36 PM UTC, comment #2:

> I do not feel comfortable with representing null as double-valued [].
> [...]
> I think one should clarify, that this returns false for null values.


There is no null values. They get automatically converted to an empty double array of size [0, 0]. This is required for Matlab compatibility (at least in 2010b).

Maybe a note on isjava remembering people that there is no null instead?

Carnë Draug <carandraug>
Project Member
Mon 20 Feb 2017 10:17:58 AM UTC, comment #1:

I do not feel comfortable with representing null as double-valued [].

The result is that the null value of a java class ,
e.g. java.math.Rounding mode is a double,
so changing the type.

b=javaArray("java.math.BigDecimal",3)
yields
b =
<Java object: java.math.BigDecimal[]>

and

b(3)=javaObject("java.math.BigDecimal",3.0)
yields

b =
<Java object: java.math.BigDecimal[]>

b(2)

yields
ans = [](0x0)
representing null.

On the other hand,
class(b(3)) yields ans = java.math.BigDecimal
whereas
class(b(2)) yields double
although in an array java.math.BigDecimal[]

Ernst Reissner <ernstreissner>
Mon 20 Feb 2017 09:54:13 AM UTC, original submission:

According to documentation, A.4
isjava (x) Return true if x is a Java object.
I think one should clarify, that this returns false for null values.

Ernst Reissner <ernstreissner>

 

(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 ernstreissner (Submitted the item)
  • -unavailable- added by ernstreissner
  •  

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

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 20 Feb 2017 06:45:17 PM UTCmtmillerSeverity3 - Normal=>2 - Minor
      Priority5 - Normal=>3 - Low
    Mon 20 Feb 2017 06:45:09 PM UTCmtmillerCategoryNone=>Documentation
    Mon 20 Feb 2017 03:48:54 PM UTCrik5Carbon-CopyRemoved 72865=>-
    Mon 20 Feb 2017 03:48:27 PM UTCrik5Summaryisjava(null) is false=>Document that no null java object exists
    Mon 20 Feb 2017 03:41:36 PM UTCcarandraugItem GroupNone=>Documentation
    Mon 20 Feb 2017 09:54:13 AM UTCernstreissnerCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1