Inspection Gadgets question

Hi.

I am using Inspection Gadgets and have stumbled on a case I just don't
understand.

My code is:
TreeContext treeContext = (TreeContext) helper.getParameter(treeId);
assert treeContext != null; // NULL means we drew a tree but the context was
thrown away
Collection updates = treeContext.handleCommand(command, nodeId,
treeInstanceId);

The code compiles.

I get a warning on treeContext.handleCommand(command, nodeId,
treeInstanceId) that says that it may produce a null pointer exception. The
method doesn't throw any exception.

Oddly, if I remove the assert or change it to == the warning goes away.

Please tell me what I am missing? I have never had that occur with this
inspection, but it seems that in this case the inspection is wrong.

Thanks,
Amnon


3 comments


This is actually a built-in inspection, not one of mine. IIRC, I already submitted a tracker entry for this bug, or one very similar.

0

Thanks. It is as if the logic is completely inversed
"Dave Griffith" <dave.griffith@cnn.com> wrote in message
news:10354973.1068855619278.JavaMail.itn@is.intellij.net...
>

This is actually a built-in inspection, not one of mine. IIRC, I already

submitted a tracker entry for this bug, or one very similar.


0


With a little experimentation, it's clear that the the dataflow equations for "assert" statements are completely scrozzled. That answers the question of whether JetBrains uses them internally, I guess. I'll clarify this and post tracker items, probably tomorrow.

--Dave

0

Please sign in to leave a comment.