Psi bug or by design?

I have the following Jsp fragment:

<% if (true) { %>
foo
<% } %>


Now I want the statements contained by this if statement:
PsiStatement[] statements =
ifStatement.getThenBranch().getCodeBlock().getStatements();

But then statements.length == 0, when I expected an array of length 1
containing a JspTemplateStatement (which implements PsiStatement). This
makes it quite hard to fix a bug in the "If Statement With Identical
Branches" inspection. Should I file a bug report?

Bas

3 comments

That's a known bug, and already requires IG to turn off inspections like "Empty Catch Block" and "Unnecessary Return" in JSP pages. For now, I'd just do the same for "If Statement with Identical Branches"

--Dave Griffith

0

This is bug. It must return array of length 3 (2 more
JspTemplateStatements). Please file bug report.

Thanks,
IK
Dave Griffith wrote:

That's a known bug, and already requires IG to turn off inspections like "Empty Catch Block" and "Unnecessary Return" in JSP pages. For now, I'd just do the same for "If Statement with Identical Branches"

--Dave Griffith

0

http://www.jetbrains.net/jira/browse/IDEA-6204
I now sort of work around it by iterating child elements and doing a
simple string compare.

Bas

Igor Kuralenok (JetBrains) wrote:

This is bug. It must return array of length 3 (2 more
JspTemplateStatements). Please file bug report.

Thanks,
IK
Dave Griffith wrote:

>> That's a known bug, and already requires IG to turn off inspections like "Empty Catch Block" and "Unnecessary Return" in JSP pages. For now, I'd just do the same for "If Statement with Identical Branches"
>>
>> --Dave Griffith

0

Please sign in to leave a comment.