[x3d-public] Interface contract bugs in X3DJSAIL (see previous mail for description)

John Carlson yottzumm at gmail.com
Wed Apr 10 15:34:47 PDT 2019


Change of subject to garner attention.

Vote: Should SAI set functions take X3D field type instances, or language type instances as parameter, or both?   Weigh in for the Python standard.

The reported bugs (below) will likely cause a version change of X3DJSAIL, and potential changes to the Java/SAI standards, perhaps even a change to Java, so it can catch errors in contracts.  I’ve done the analysis, as previously reported.   The gist is that the X3DJSAIL Java concrete class setters return a concrete class, and the corresponding SAI interface setter returns an abstract class. I believe the return class types should be identical.

 Below are the Java interface contract violations found by  *.future.py.  I suggest we try to figure out how to fix these before proceeding with *.future.py, or if we decide we want to stop work on the Pipelining Serializer which generates the *.future.py files.  Note that the other serializer does not used return values except for constructors, so it is not affected.  Can we add these methods to the interface standard and have it work?  Or between jsail and sai packages in the call sequence.

One thing I could try in *.future.py is converting all primitive types parameters to X3D concrete class parameters.  Would that work?  It might be worth a try.

So for example, there are 3 setTranslations in TransformObject.java:

TransformObject.java:   public TransformObject setTranslation(float[] newValue)
TransformObject.java:   public TransformObject setTranslation(SFVec3fObject newValue)
TransformObject.java:   public TransformObject setTranslation(float x, float y, float z)

I would choose one of the latter 2 in my client code.   Then the interface setter, in Transform.java

Transform.java: public Transform setTranslation(float[] newValue);

would be ignored, and I think the problem might be fixed.   Except that I believe, according contracts, TransformObject should implement a setTranslation that returns a Transform.  Since setTranslation would really be returning a TransformObject, I think everything is kosher.   So the rule is, if you want to call one of the below methods (they may be non-SAI), you need to use a non-SAI method as a setter before it.

Perhaps this is caused by PyJNIus’es use of signatures?

I don’t know much about interface contracts, so someone can correct me. Something’s fishy.

Casting can probably get around this issue, but isn’t casting ugly?  I don’t think I even want to look at what a mess the *.future.py programs would look like.

Anyway, it seems like I’m point out good things (potential bugs) in SAI.   That’s a good feeling.  Probably they’ve all been covered before.

Now I know why we need *.future.py!

Onward!

John

   [exec] AttributeError: 'org.web3d.x3d.jsail.X3DConcreteNode' object has no attribute 'addChild'
     [exec] AttributeError: 'org.web3d.x3d.sai.Core.ProtoInstance' object has no attribute 'addFieldValue'
     [exec] AttributeError: 'org.web3d.x3d.sai.Core.X3DMetadataObject' object has no attribute 'setValue'
     [exec] AttributeError: 'org.web3d.x3d.sai.Core.X3DNode' object has no attribute 'setName'
     [exec] AttributeError: 'org.web3d.x3d.sai.Core.X3DNode' object has no attribute 'setTitle'
     [exec] AttributeError: 'org.web3d.x3d.sai.EnvironmentalEffects.X3DBackgrou' object has no attribute 'setFrontTexture'
     [exec] AttributeError: 'org.web3d.x3d.sai.EnvironmentalEffects.X3DBackgrou' object has no attribute 'setLeftUrl'
     [exec] AttributeError: 'org.web3d.x3d.sai.Grouping.Transform' object has no attribute 'addChild'
     [exec] AttributeError: 'org.web3d.x3d.sai.Grouping.X3DGroupingNode' object has no attribute 'addChild'
     [exec] AttributeError: 'org.web3d.x3d.sai.Grouping.X3DGroupingNode' object has no attribute 'setCenter'
     [exec] AttributeError: 'org.web3d.x3d.sai.Grouping.X3DGroupingNode' object has no attribute 'setIS'
     [exec] AttributeError: 'org.web3d.x3d.sai.Grouping.X3DGroupingNode' object has no attribute 'setScale'
     [exec] AttributeError: 'org.web3d.x3d.sai.Grouping.X3DGroupingNode' object has no attribute 'setTranslation'
     [exec] AttributeError: 'org.web3d.x3d.sai.Grouping.X3DGroupingNode' object has no attribute 'setWhichChoice'
     [exec] AttributeError: 'org.web3d.x3d.sai.Lighting.X3DLightNode' object has no attribute 'setLocation'
     [exec] AttributeError: 'org.web3d.x3d.sai.Navigation.LOD' object has no attribute 'addChild'
     [exec] AttributeError: 'org.web3d.x3d.sai.Navigation.X3DViewpointNode' object has no attribute 'setCenterOfRotation'
     [exec] AttributeError: 'org.web3d.x3d.sai.Navigation.X3DViewpointNode' object has no attribute 'setFieldOfView'
     [exec] AttributeError: 'org.web3d.x3d.sai.Navigation.X3DViewpointNode' object has no attribute 'setPosition'
     [exec] AttributeError: 'org.web3d.x3d.sai.Networking.X3DUrlObject' object has no attribute 'addChild'
     [exec] AttributeError: 'org.web3d.x3d.sai.Rendering.X3DGeometricPropertyNo' object has no attribute 'setPoint'
     [exec] AttributeError: 'org.web3d.x3d.sai.Rendering.X3DGeometryNode' object has no attribute 'setCoord'
     [exec] AttributeError: 'org.web3d.x3d.sai.Scripting.X3DScriptNode' object has no attribute 'addField'
     [exec] AttributeError: 'org.web3d.x3d.sai.Shape.X3DAppearanceNode' object has no attribute 'setMaterial'
     [exec] AttributeError: 'org.web3d.x3d.sai.Shape.X3DMaterialNode' object has no attribute 'setDiffuseColor'
     [exec] AttributeError: 'org.web3d.x3d.sai.Shape.X3DMaterialNode' object has no attribute 'setIS'
     [exec] AttributeError: 'org.web3d.x3d.sai.Sound.X3DSoundNode' object has no attribute 'setLocation'
     [exec] AttributeError: 'org.web3d.x3d.sai.Time.X3DTimeDependentNode' object has no attribute 'setCycleInterval'

Sent from Mail for Windows 10




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190410/2ae3f175/attachment-0001.html>


More information about the x3d-public mailing list