bugGNU Octave - Bugs: bug #60124, Implement '-full' option for...

 
 

bug #60124: Implement '-full' option for fieldnames() with Java objects

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Fri 26 Feb 2021 10:28:12 AM UTC  
 
Category:  Octave Function Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Reissner Open/Closed:  Open
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.

 

( Jump to the original submission)

Mon 01 Mar 2021 12:13:48 AM UTC, comment #6: 

I cannot find any more either. version 4.3.0 has some chance to be the one, if not, i cannot help.

Ernst Reissner <ernstreissner>
Mon 01 Mar 2021 12:02:06 AM UTC, comment #5: 

Since Octave never seemed to have implemented '-full' for the fieldnames function I'm changing this report to a feature request and marking as confirmed.

Rik <rik5>
Project Administrator
Sun 28 Feb 2021 01:16:49 PM UTC, comment #4: 

@rik, @philip
well, I dont know the old versions, but i remember 4.3.0+ or something.
To avoid those inconsistencies, I would like to add check on java versions in future to be able to tell you from the code,
in which versions what worked quite well.

In fact, i adapted the testcases to the output of octave.

Yes, it was never documented, although really necessary.

Ernst Reissner <ernstreissner>
Fri 26 Feb 2021 04:57:02 PM UTC, comment #3: 

I tried

methods ('java.lang.Double', "-full")

and this fails with an 'invalid call to methods' in version 5.2.0.

I then tried creating an instance of a Java class and trying methods and that fails too.

x = javaObject ('java.lang.Double', pi)
methods (x, '-full')

The same situation exists with version 4.4.1.  I carried back through versions 4.2.X, 4.0.X, and 3.8.2 and the '-full' option always throws an error.

It doesn't seem that the capability existed until it was implemented in 6.1.0, so I don't think the bug summary is correct that it disappeared.

Rik <rik5>
Project Administrator
Fri 26 Feb 2021 12:30:22 PM UTC, comment #2: 

I think the link I sent gives a hint of how to invoke it
and what it shall deliver.
Below I attached old java unit test.
I think it is easy to understand how it worked.
I had to disable that test in some version, but,
no idea when.
Note also that the test does show modifiers like static,
but it may not show inheritance information.
I am not sure how complete the old implementation really was.

    private void testFieldnamesFull(String arg) {
          this.oct.eval("f1=fieldnames(" + arg + ", '-full');");
        // ordering is immaterial
        this.oct.eval("f2={" +
                      // non-public field inaccessibleI does not show up

                      // primitive types

                      // char and Character
                      "'char cVal', 'java.lang.Character cVAL', " +
                      // boolean and Boolean
                      "'boolean zVal', 'java.lang.Boolean zVAL', " +
                      // float types
                      "'double dVal', 'java.lang.Double dVAL', " +
                      "'float fVal', 'java.lang.Float fVAL', " +
                      // integer types
                      "'long jVal', 'java.lang.Long jVAL', " +
                      "'int iVal', 'java.lang.Integer iVAL', " +
                      "'short sVal', 'java.lang.Short sVAL', " +
                      "'byte bVal', 'java.lang.Byte bVAL', " +

                      // arrays of primitive types

                      // char and Character arrays
                      "'char[] acVal', 'java.lang.Character[] acVAL', " +
                      // boolean and Boolean arrays
                      "'boolean[] azVal', 'java.lang.Boolean[] azVAL', " +
                      // float type arrays
                      "'double[] adVal', 'java.lang.Double[] adVAL', " +
                      "'float[] afVal', 'java.lang.Float[] afVAL', " +
                      // integer type arrays
                      "'long[] ajVal', 'java.lang.Long[] ajVAL', " +
                      "'int[] aiVal', 'java.lang.Integer[] aiVAL', " +
                      "'short[] asVal', 'java.lang.Short[] asVAL', " +
                      "'byte[] abVal', 'java.lang.Byte[] abVAL', " +

                      "'java.lang.Byte[][] aabVAL', " +

                      // non-primitive java.lang.Number type
                      "'java.math.BigDecimal bdVal', " +
                      // static field
                      "'static java.util.Comparator cmp', " +
                      "'java.lang.String str', " +
                      "'java.lang.String[] aStr'" +
                      "};");
        this.oct.eval("z=isempty(setxor(f1, f2));");
        assertTrue(this.oct.getBool("z"));

        // weakness: no inheritance information,
        // because the only superclass, Object, has no fields.
    }

Ernst Reissner <ernstreissner>
Fri 26 Feb 2021 11:39:53 AM UTC, comment #1: 

When did 'fieldnames (., "-full")' work? Do you have example code for how to invoke it?

Anyway it isn't documented in 4.2.0 and later releases.

Philip Nienhuis <philipnienhuis>
Project Member
Fri 26 Feb 2021 10:28:12 AM UTC, original submission:  

https://uk.mathworks.com/help/matlab/ref/fieldnames.html

For fieldnames parameter '-full' disappeared.
But it is for matlab compatibility.

In old implementation, it offered modifiers type and name.
Modifiers were static final transient volatile.

Ernst Reissner <ernstreissner>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-01 rik5 Severity3 - Normal => 1 - Wish
        Priority5 - Normal => 3 - Low
    2021-03-01 rik5 Item GroupMatlab Compatibility => Feature Request
        StatusNeed Info => Confirmed
        Release5.2.0 => dev
        Summaryfieldnames(.,'-full') disappeared => Implement '-full' option for fieldnames() with Java objects
    2021-02-26 philipnienhuis StatusNone => Need Info
    2021-02-26 ernstreissner Carbon-Copy- => Added rei3ner@arcor.de

    Back to the top


    Powered by Savane 3.6