bugGNU Octave - Bugs: bug #39074, java_get deprecated ok?

 
 

bug #39074: java_get deprecated ok?

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Sun 26 May 2013 10:41:34 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Ernst ReissnerOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 17 Jul 2013 10:38:22 PM UTC, comment #2:

See the Mathworks Documentation on this subject (http://www.mathworks.com/help/matlab/matlab_external/creating-and-using-java-objects.html?nocookie=true#f56755).

In particular, this boxed comment

Matlab does not allow the CLASSNAME.STATIC_FIELD syntax for setting, although it does for getting. However, they do support a universal syntax which works for both getting and setting. In this case you can get or set any static field of a class from any particular instance of the class.

This universal syntax works in Octave or Matlab:

As a concrete example,

It is usually better to use any getter/setter method that CLASSNAME may have provided rather than breaking encapsulation to get at the data directly. You can call these methods directly with javaMethod() without needing to create an instance of the class.

Rik <rik5>
Project Administrator
Sun 26 May 2013 08:17:02 PM UTC, comment #1:

Confirmed.

In the io package, in e.g., private/__JOD_spsh2oct__.m, there are several examples that still need java_get.

BTW java_get (and java_set) will be kept for the next two stable releases so no worries for the time being; but I agree a replacement for static fields is warranted.

Philip Nienhuis <philipnienhuis>
Project Member
Sun 26 May 2013 10:41:34 AM UTC, original submission:

java_get is deprecated now and it is advised to use dot notation instead: instance.fieldname.
But java_get is also used for static access like Class.fieldname.

Well but at least for me, for static fields this does not work.

So there are two ways: sticking to java_get and undeprecating
or providing Class.fieldname.

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 rik5 (Posted a comment)
  • -unavailable- added by ernstreissner (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 17 Jul 2013 10:38:22 PM UTCrik5Open/ClosedOpen=>Closed
    Sun 26 May 2013 08:17:02 PM UTCphilipnienhuisStatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1