sshyran / genxdm

Automatically exported from code.google.com/p/genxdm
0 stars 0 forks source link

Model API insufficiently documented for null node argument; implementations vary unacceptably #120

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Most model methods take a <N>ode argument. What happens if the argument is null?

The javadoc doesn't say (it should). Implementations vary.

DOM: check for null, return null, or empty-set somehow defined.

Cx: assume non-null (NPE).

Axiom: check for non-null and assert if null.

Inconsistency is bad, m'kay?

Recommended resolution: assert if null. Passing null is meaningless; you 
shouldn't do it. Avoiding a throw isn't doing anyone a favor, it's just hiding 
laziness, making it harder to resolve in the end. So the Axiom bridge has it 
right; other bridges should change to do the same thing: 
PreCondition.assertNotNull(node);

Document this in the API (mostly NodeInformer, btw).

Note that this cannot happen for Cursor (because a Cursor cannot lack its 
context node).

Original issue reported on code.google.com by aale...@gmail.com on 18 Jan 2013 at 5:36

GoogleCodeExporter commented 8 years ago
resolved. contracts for Model have all had documentation changed; Cx, Axiom, 
and DOM now use PreCondition.assertNotNull extensively.

Original comment by aale...@gmail.com on 23 Jan 2013 at 6:56

GoogleCodeExporter commented 8 years ago
And mark it done. Grrr.

Original comment by aale...@gmail.com on 23 Jan 2013 at 6:59