bugGNU Octave - Bugs: bug #48593, function struct on java objects

 
 

bug #48593: function struct on java objects

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Fri 22 Jul 2016 12:19:46 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Need Info Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 23 Aug 2016 08:11:46 PM UTC, comment #10: 

Ah little appendix:

documentation:

I read:
'If the argument is an object, return the underlying struct.'

should be replaced by

'If the argument is an Octave object or a Java object,
return the underlying struct.'

Maybe a word on static fields.

Ernst Reissner <ernstreissner>
Tue 23 Aug 2016 06:13:20 PM UTC, comment #9: 

Ok now comes the final patch.

(file #38332)

Ernst Reissner <ernstreissner>
Tue 23 Aug 2016 05:02:48 PM UTC, comment #8: 

I would like to ask a question on struct of java object:
what about the static fields of the class?
Are they also included in the struct???

We really need someone with a Matlab license to try.

Ernst Reissner <ernstreissner>
Tue 23 Aug 2016 01:38:11 PM UTC, comment #7: 

sorry, correction.

(file #38329)

Ernst Reissner <ernstreissner>
Tue 23 Aug 2016 01:23:22 PM UTC, comment #6: 

to implement struct,
one has to find out a list of field names as strings.
To that end, get_invoke_list (JNIEnv *jni_env, void *jobj_arg)
returning the list of fields and methods is broken into two halfs,
both implemented by get_mf_list
which return either fields or methods depending on a parameter.

I provided in comments the methods get_field_list and get_method_list which are an alternative to get_mf_list.

Dear reviewer,
take whatever you consider better and drop the rest.

(file #38328)

Ernst Reissner <ernstreissner>
Sun 21 Aug 2016 02:45:31 AM UTC, comment #5: 

Prior to really implementing this,
I decided to rework DEFUN struct in ov-struct.cc.
I unveilded the various steps for ease of review,
that I did not change functionality at all.

(file #38293, file #38294, file #38295, file #38296)

Ernst Reissner <ernstreissner>
Fri 19 Aug 2016 10:55:55 PM UTC, comment #4: 

The attached patch is a reimplementation
of fieldnames, methods and constructors,
or, to be more precise of the according methods in ClassHelper.
Methods getFieldsXXX, getMethodsXXX and getConstructorsXXX:
The return type changed from String to String[],
from ';'-separated list of objects to array of objects.

This is more suitable to implementation of struct of java object.

(file #38287)

Ernst Reissner <ernstreissner>
Fri 19 Aug 2016 10:03:57 AM UTC, comment #3: 

what kind of information do you require to confirm or to reject this bugreport?

Ernst Reissner <ernstreissner>
Fri 29 Jul 2016 01:28:48 AM UTC, comment #2: 

yes, java fields are turned into struct fields.
If none present, then the resulting struct is empty.

Ernst Reissner <ernstreissner>
Fri 22 Jul 2016 04:14:16 PM UTC, comment #1: 

So public data members of the class are turned into fields of the struct? If a class has no public data members does Matlab return an empty struct?

Mike Miller <mtmiller>
Group Member
Fri 22 Jul 2016 12:19:46 AM UTC, original submission:  


http://de.mathworks.com/help/matlab/matlab_external/handling-data-returned-from-a-java-method.html

shows that method struct can also be applied to java objects.

If done, Octave outputs
error: struct: additional arguments must occur as "field", VALUE pairs


because the object is not recognized as java object.

Ernst Reissner <ernstreissner>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38332:  patchBug48593H.patch added by ernstreissner (3KiB - text/x-patch)
file #38329:  patchBug48593G.patch added by ernstreissner (964B - text/x-patch)
file #38328:  patchBug48593F.patch added by ernstreissner (11KiB - text/x-patch)
file #38293:  patchBug48593A.patch added by ernstreissner (15KiB - text/x-patch)
file #38294:  patchBug48593C.patch added by ernstreissner (2KiB - text/x-patch)
file #38295:  patchBug48593B.patch added by ernstreissner (3KiB - text/x-patch)
file #38296:  patchBug48593D.patch added by ernstreissner (2KiB - text/x-patch)
file #38287:  patchBug48593A.patch added by ernstreissner (15KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-23 ernstreissner Attached File- Added patchBug48593H.patch, #38332
    2016-08-23 ernstreissner Attached File- Added patchBug48593G.patch, #38329
    2016-08-23 ernstreissner Attached File- Added patchBug48593F.patch, #38328
    2016-08-21 ernstreissner Attached File- Added patchBug48593A.patch, #38293
        Attached File- Added patchBug48593C.patch, #38294
        Attached File- Added patchBug48593B.patch, #38295
        Attached File- Added patchBug48593D.patch, #38296
    2016-08-19 ernstreissner Attached File- Added patchBug48593A.patch, #38287
    2016-07-22 mtmiller CategoryNone Interpreter
        Item GroupNone Matlab Compatibility
        StatusNone Need Info
        Release4.0.1 dev
    2016-07-22 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4b4b.
    Corresponding source code