Assert statements?

I’m noticing a couple assert statements added to odejava which seem to be a bit dubious, first for the fact that assert statements never really became that widely utilized so I’d recommend not using them. Secondly though, the assert seems to modify a variable which is a definate no go since you can turn asserts off at runtime so that line would never be executed.

Does anyone need those things in there?

Matt

Nothing wrong with asserts - they are good in the fact that production code doesn’t have to enable them - hence reducing some checks. They are binary backward compatable to other JVM’s as well so no problem.

I agree that they shouldn’t alter variables - we can fix the one assert which does.

However - in the case in question it is harmless as that variable is literally used for nothing else but the assert in question.


    public World() {
        assert worldCount++ == 0: "Create World class only once. Multiple Worlds are not yet supported.";
        worldId = Ode.dWorldCreate();
        Ode.setWorldID(worldId);
    }

the worldCount has no other use than for asserts. I am happy to patch it for you just as a matter of principal if you like.

Cheers,

Will.

Ok, sounds reasonable. I’ve never seen anyone use asserts in an open source project so I wanted to make sure that everyone was ok with it. Since everyone seems to be me, you and Jani, let’s leave em in! ;D

Matt