History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-13154
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Maxim Shafirov
Reporter: Derek Foster
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

@NotNull (constant condition) checking confused by irrelevant try...catch block

Created: 02 Dec 06 05:54   Updated: 13 Jan 07 17:25
Component/s: Code Analysis. Inspection, Editor. Error Highlighting
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 6,107
Severity: High


 Description  « Hide
In the the following method, the Idea editor correctly reports "condition foo != null is always true":

public void bar(@NotNull Object foo)
{
assert foo != null;
// try
// { // // }
// catch (NumberFormatException ex)
// {//// } }
}

However, if I uncomment the try..catch block in the above method, Idea incorrectly omits the warning on the assert statement. This seems quite repeatable.

This appears to be a clear bug in the Idea data flow tracing code. Interestingly, if the catch block is changed to catch type Exception rather than a RuntimeException-derived type, the warning message reappears.



 All   Comments   Work Log   Change History      Sort Order:
Derek Foster - 02 Dec 06 05:56
Hmm. Let's try that code sample again:

Version A:

public void bar(@NotNull Object foo)

{ assert foo != null; }

Version B:

public void bar(@NotNull Object foo)
{
assert foo != null;
try
{
}
catch (NumberFormatException ex)
{
}
}