False error reported in editor, compile is fine

IntelliJ IDEA 11.1.3

I have a multi module project where one of the modules encapsulates an XML schema and generates entities mapped to both JAXB and JPA.  Another module, which depends on the first, when using entities from the first module, reports 'incompatible types'.

the simple assignment:

ClassType act = anEvent.getInternalClassification();

reports that it requires com.xxx.yyy.zzz.ClassType (same class as shown on import line, entity from first module)
but found ClassType

The object being acted on, anEvent, is also an entity from the first module.  I get no errors reported on it, I assume because it is being passed in.  However every method reference of anEvent that returns a type defined in the first module automatically code-completes the type as the fully qualified name from the first module and reports that it cannot resolve the type.  When I copy the automatically generated type into an import statement and remove the fully-qualified portion, then the import shows nothing is wrong, but that is when I get the incompatible types.

The modules all build fine and seem to function fine, but I object to all of the auto-completion that happens as I am trying to edit this file, as well as the erroneous error marks that show up.

I have tried clearing the cache multiple times, I have deleted the cache by hand (system directory), I have restarted, reloaded, all to no avail.  I cannot find any other references to an issue such as this so am reaching out to the community.

Thanks in advance for any assitance or ideas that you can give.

1 comment
Comment actions Permalink

JiroDan wrote:

I object to all of the auto-completion that happens as I am trying to edit this file

You can turn off auto popuup of auto completion in the settings. File > Settings > IDE Settings > Editor > Code Completion. If you uncheck the "Autopopup code completion in (ms):" option, auto completion will only "launch" when you initiate it via the Ctrl+Space key sequence.

Overall, IDEA's error checking is very reliable and accurate. Over the years there have been a few occasions where I start to think it is reporting a false error. But after digging a bit deeper, I find that it is correct in the warning  or error it is reporting. Still, there may be cases or situations where is cannot correctly derive something and thus give a false warning. In those cases, you have the option to:

  1. Suppress the warning for the
    1. Statement
    2. Method
    3. Class
  2. Reducing the warning level of an inspection
  3. Disabling an inspection

Before suppressing the warning or disabling the inspection, see if IDEA suggests a quick fix for the issue. Place your cursor on the warning ant type Alt+Enter. Select a quick fix if offered to resole the issue. If there is no quick fix, one of the options on the quick fix popup (Alt+Enter) will be: "Inspection 'The name of the inspection' options >". If you select that and hit the right arrow key, you will get a list of options to suppress the warning or to edit the inspection settings.

You can also bulk edit the inspection settings via File > Settings > Project Settings > Inspections or by double clicking Hector the Inspector hectorOn.png in the lower right corner and selecting "Configure Inspections".

In regards to your specific case, I find it interesting that it is reporting the not Found as "ClassType" without any package. Usually that error shows both classes fully qualified. Do you by chance have a "ClassType" class in the root source directory?


Please sign in to leave a comment.