JavaDoc oops in com.jme3.scene.Node.attachChild()

[java]
* @throws NullPointerException If child is null.
*/
public int attachChild(Spatial child) {
if (child == null)
throw new IllegalArgumentException(“child cannot be null”);
[/java]

The documentation should probably say
[java]
* @throws IllegalArgumentException If child is null.
[/java]

Or perhaps the code should be changed to match the JavaDoc, though that might conceivably break someone’s app.

2 Likes
@sgold said: [java] * @throws NullPointerException If child is null. */ public int attachChild(Spatial child) { if (child == null) throw new IllegalArgumentException("child cannot be null"); [/java]

The documentation should probably say
[java]
* @throws IllegalArgumentException If child is null.
[/java]

Or perhaps the code should be changed to match the JavaDoc, though that might conceivably break someone’s app.

No, the old code was silly and was fixed. Now the javadoc is wrong. Code should never throw NullPointerException.

1 Like

So. Would someone please correct the javadoc?

Someone will.

1 Like

Why do you believe that? It hasn’t been fixed yet: https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/scene/Node.java

1 Like

Thanks to whoever threw me the minus about a javadoc change… I will now NEVER be making this change that is somehow critical. Sometimes this community bites.

Hopefully someone else will care enough to help. I’m done with these threads.

Maybe instead of -1ing people you could file a bug report so that the person who incompletely made the original change might finish noting this “exception that you should not be catching anyway”.

1 Like
@sgold said: Why do you believe that? It hasn't been fixed yet: https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/scene/Node.java

OMG! Call the goddamn POLICE! The engine throws the wrong error! This is the END OF THE WORLD!!!111oneoneone

Calm the eff down, geez. It’s not even a minor thing. I’m tempted to commit a fix but I’m too amused by your over-the-top reaction.

I regret hurting your feelings, @pspeed.

I’m grateful for suggestion to file a bug report; previously I’d assumed only developers could do that.

The -1 has been changed to a +1, and an issue (#604) has been filed.