[x3d-public] Sample X3D Python API; examplespublishedforcontinuing improvement

John Carlson yottzumm at gmail.com
Mon Apr 22 21:52:09 PDT 2019


In other words, the return value may affect which method is called. Since you broke the interface contract by returning  a concrete class, it cannot find the concrete class (Which one to choose from?).  I think the highest return type in the hierarchy may be the return type in pyjnius (but might need a bit more research).  I don’t know enough about pyjnius internals, and if we can’t get support from kivy (try GitHub next), I don’t know if we should make it the centerpiece of our API.

It seems apparent to me that the interface type is being returned somehow, I just don’t know how, except in a signature, which would likely strip the type information about the concrete class.

I’m no genius, just guessing here. I’d rather use a broken, but working SAI than fix pyjnius.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Monday, April 22, 2019 11:27 PM
To: Brutzman, Donald (Don) (CIV)
Cc: X3D Graphics public mailing list
Subject: RE: [x3d-public] Sample X3D Python API;examplespublishedforcontinuing improvement

I think it has something to do with the method signatures and how pyjnius handles them.   The jar has the abstract class, so any code in Java which references the abstract class will load it.

See my code for a non-SAI solution.

Locations of X3DViewpointNode:

$ find . -type f -print0| xargs -0 grep -l X3DViewpointNode
./classes.json
./fieldTypes.js
./mapToMethod.js
./org/web3d/x3d/sai/Navigation/X3DViewpointNode.py
./X3Dautoclass.py
./__pycache__/X3Dautoclass.cpython-36.pyc

So you can try removing X3DViewpointNode.py and X3Dautoclass.py for a test.  I am happy with my fix until we find something we can’t fix.

John

Sent from Mail for Windows 10

From: Brutzman, Donald (Don) (CIV)
Sent: Monday, April 22, 2019 10:57 PM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: [x3d-public] Sample X3D Python API; examplespublishedforcontinuing improvement

Our messages crossed but are quite similar... we might have the problem surrounded I hope...

On 4/22/2019 8:45 PM, John Carlson wrote:
> This is a more broad problem than pyjnius, and is likely a Java problem that is letting things past the interface contract.  Okay, I will try to explain what the bug is:
> 
> setDEF in X3DViewpointNode returns an X3DViewpointNode (interface)
> 
> public X3DViewpointNode setDEF(String newValue);
[...]

Please make sure that you have _no_ references to abstract class X3DViewpointNode anywhere in your code.

The Java source for concrete class ViewpointObject specifically overrides its abstract parent superclass with an @Override annotation.  Inside X3DJSAIL the setDEF() method correctly returns type ViewpointObject.

If we remove all references to X3D*Node abstract classes everywhere and the problem still occurs, then
- perhaps not all of those definitions are removed, or
- perhaps an old file in the path is somehow visible, or
- we have isolated a bug in Pyjnius that we can ask them to fix.

Good luck sir.

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190422/336dd0ba/attachment.html>


More information about the x3d-public mailing list