"Method '...' is too complex to analyze by data flow algorithm"

Hi,

I just noticed this warning, signaled by a wavy grey underscore on the name of the method in question. The extended description reads:

"This inspection reports those conditions in the specified inspection scope that are always true or false, as well as points out where a RuntimeException may be thrown, based on data flow analysis of the code."

The method in question is not particularly complex:


So what's the deal with this? Which inspection is creating it? What's too complex about that code?

I'm running EA 7312 under 1.6.0_02 on Linux.

Randal Schulz

8 comments

Hello Randall,

I just noticed this warning, signaled by a wavy grey underscore on the
name of the method in question. The extended description reads:

"This inspection reports those conditions in the specified inspection
scope that are always true or false, as well as points
out where a RuntimeException may be thrown, based on data flow
analysis of the code."

So what's the deal with this? Which inspection is creating it?


As you can see from the description, the "Constant Conditions and Exceptions"
inspection is creating it. Note that the only thing new for this is the warning
itself: previously such methods were silently ignored, and you got no null
pointer highlighting etc. in such methods.

What's
too complex about that code?


I don't know the exact rules for detecting too complex methods - Max Shafirov
will probably answer this part.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Yeah I noticed this as well for a few of my methods. Seems like a few nesting levels (sometimes unavoidable) may be triggering it.

0

Hello Randall,

...

As you can see from the description, the "Constant
Conditions and Exceptions" inspection is creating it.


Eh? How can I see that? That name is not present in the description.

Note that the only thing new for this is the warning
itself: previously such methods were silently
ignored, and you got no null
pointer highlighting etc. in such methods.


OK. The code isn't too new, but the hilight is subtle enough that thought I might have missed it before. There is a regular yellow warning marker in the right gutter, though.


Randall Schulz

0

Is there any way to disable the "too complex" portion of the inspection but still keep the inspection enabled for not-too complex methods?

0

Hello k,

Is there any way to disable the "too complex" portion of the
inspection but still keep the inspection enabled for not-too complex
methods?


No, the highlighting of code which is too complex to analyze can't be separately
disabled.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

i'm still trying to figure this out...

a) is the "too complex" supposed to be a warning that the code actually is too complex and should be refactored?

or

b) is the "too complex" just information that the analyzer is not up to task to analyze the particular method?


if the answer is (a) then there are some pretty simple methods it can't analyze. if the answer is (b) then why is this highlighting as yellow warning instead of just info

I try to keep my files "green" but this particular inspection has turned many of them yellow. I want to keep the inspection on but if a method is too complex for it I don't want my entire file marked yellow because of it.

0

Hello k,

i'm still trying to figure this out...

a) is the "too complex" supposed to be a warning that the code
actually is too complex and should be refactored?

or

b) is the "too complex" just information that the analyzer is not up
to task to analyze the particular method?

if the answer is (a) then there are some pretty simple methods it
can't analyze. if the answer is (b) then why is this highlighting as
yellow warning instead of just info


The answer is (b), and the "too complex" highlighting is shown with INFO
severity.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

If I'm looking at the correct inspection, "Constant conditions & exceptions" in the "Probable bugs" section, then this is a "warning" / yellow by default, but that can be changed to any defined severity level, including one of the user's own definition.

Randall Schulz

0

Please sign in to leave a comment.