MeFisto94 / jme-discussion

This Repository is used to keep track of potential future feature additions to the jMonkeyEngine. Look at the Issues.
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Use assertions over if's or not doing anything #7

Open MeFisto94 opened 4 years ago

MeFisto94 commented 4 years ago

Generally there are lots of places where we prevent the user from doing bad things.

A quite wished for feature here is the ConcurrentModificationException for the SceneGraph: A simple if !Thread.currentThread().getName().equals("jMe3-MainThread") before every SceneGraph Modification would help debugging those issues much much better, but would slow everything down. This could be an assertion. As could be checking for non-uniform scale on non-root-nodes etc pp.

Note: The above shouldn't be implemented as is, because with proper locking accessing from another state is okay, as can this issue be caused by other things as well (forgetting to call the right updated methods on a custom viewport). Also I think a custom engine build with diagnostic logging on everything in the Spatial class with stacktraces might help more in that case.

Still there are quite a few things where assertions could happen over a NullPointerException or others.