Why all those "too complex to analyze by data flow algorithm"

All these "method is too complex to analyze by data flow algorithm" warnings in v12.0.4 (and also earlier versions) is driving me crazy.
I am using the 64-bit version, on Windows 7.
For example this method:

   @Override
   public void cleanupInstance ()
   {
      try
      {
         JTree swingTree = watchesTree.getJTree();
         if (swingTree != null)
            swingTree.removeTreeWillExpandListener(watchesExpListener);


         tabPan.removeAllTabs();
         threadList.cleanupInstance();
         inspectorTabPan.removeAllTabs();
         executionPointContainer = null;


         autoInspectionSplit2.cleanupInstance();

         if (debugAdapter != null)
         {
            debugAdapter.cleanupInstance();
            debugAdapter = null;
         }


         if (scriptBeingExecuting != null)
         {
            scriptBeingExecuting.cleanupTempIpcFile(false);
            scriptBeingExecuting = null;
         }
      }
      finally
      {
         super.cleanupInstance();
      }
   }


What is so complex about it?

10 comments

Nothing complex, so it looks like a bug. Does the problem go away if you make an insignificant change to the method body? Is the method in an inner class?
Have you tried 12.1 EAP, does the problem persist there?

0

No, this method is not in an inner class. And the class has no inner-classes.

I can sometimes get rid of the warning by refactoring parts of the method out into separate private inner-methods. It looks like try/finally often cause this warning. The problem is that this warning is very frequent, and it often showns on methods that are not complex at all. I have seen it even on a method with no flow control or try/finally and just a very few plain and simple method calls. It seems to occur more and more often as our project grows in size. I have not tried the 12.1 EA version and I don't want to since I am working on a large and shared business production project and I see no signs in the change-list that this problem has been worked on by the IDEA-team. The problem with these false complexity-warnings has been there as long as I can remember, and I have used IDEA since version 9, if I remember correct.

I also use R# with Studio, and this problem is not existing there at all. Not even on true complex methods.

0

I've tried to recreate the problem with the code you provided, but no luck. Apparently there's something in the surrounding code that contributes to the problem. Do any of the called method declare to throw (un)checked exceptions? Which Java language level are you using in that code? Is it possible for you to create a small sample project where this problem occurs and provide it?

0

Please add the following to idea/bin/log.xml:

<category name="#com.intellij.codeInspection.dataFlow.DataFlowRunner">
<level value="DEBUG"/>
<appender-ref ref="FILE"/>
</category>


After that please restart IDEA, edit the method which is reported as too complex and provide the log (Help | Reveal log). You might want to create a new issue at http://youtrack.jetbrains.com/ and attach the report there where you can set it to be visible only to IDEA developers.

0

When attempting to trim down the code in order to get a reproducable case that is as small and compact as possible I noticed that the data flow warning disappeared when removing certain JavaDoc-comments. I added the log-configuration as you descibed above and I see it produce a number of idea.log-files in the .IntelliJIdea12/system/log directory. I have zipped all of them and attached them here. Please let me know if you need more details in order to analyze.



Attachment(s):
log.zip
0

Thanks, both for the logs and using the latest IDEA with more logging added. It's hard to tell which exactly method has produced the warning, so could you please give some hints, e.g. provide its text? Or just open the method you've already provided earlier, and attach the logs for its highlighting.

Which Javadoc tags did you remove?

0

Sorry, I forgot to mention the provided log was from a source that is different from the one first mentioned.

I tried once more to trim down the new source for simplified reproducability, but the flow analyzer seems to be more dynamic than expected because after trimming down a bit the warning was gone and I could not get it back until restoring almost all parts of the trimmed code. So I reverted back to the full code. Please see new log-files attached. The warning occurs on several methods in this source module, but the method I focused on when editing the last time was the method called "getMainServerRef()".



Attachment(s):
log2.zip
0

Could I see the method body please? :)

0

   @NotNull
   private MainServerModel getMainServerRef () throws Exception
   {
      switch (ourServerAddress.getServerType())
      {
         case EJB:
         {
            if (isServerSide())
            {
               Log.print(Log.Info, Log.TEST, this, "%s", mainServerAddress.getRemotingName());
               return (MainServerModel) mainServerAddress.lookupServer();
            }
            else
            {
               Log.print(Log.Info, Log.TEST, this, "");
               return (MainServerModel) AbstractClusterNode.getServerNode();
            }
         }

         case RMI_OR_RMISSL:
         {
            if (isMainServerNode())
               return (MainServerModel) AbstractClusterNode.getServerNode();
            Log.print(Log.Info, Log.TEST, this, "%s", mainServerAddress.getRemotingName());
            return (MainServerModel) mainServerAddress.lookupServer();
         }

         case HTTPS:
         {
            if (isServerSide())
               return (MainServerModel) AbstractClusterNode.getServerNode();
            return null;
         }
      }

      throw new IllegalStateException(String.format("Unknown Server Type: %s", ourServerAddress.getServerType()));
   }

0

Thank you! I've just added more logging, please try a newer build.

0

Please sign in to leave a comment.