Rebuild does not find some JDK classes but build does

Hi,

I have a weird problem. In one of my projects a compile error suddenly appeared when issuing a "Rebuild":

java: /Users/krueger/repos/de.lesspain.mediatool/de.lesspain.mediatool/src/de/lesspain/mediatool/browser/BrowseViewPartImpl.java:905: cannot find symbol
symbol  : class JButton
location: class de.lesspain.mediatool.browser.BrowseViewPartImpl

The referenced class is javax.swing.JButton and is included and in the editor I can navigate the link without problems.

When I then hit "Make Project" the error (and all the ones that are caused by it) goes a way. This is reproducible. I even tried clearing my cache and restarting but nothing helped.

Upgrading to version 13 (Community Edition) did not change anything either. I am working on Mac OSX with Apple's JDK6.

Any idea anyone?

Regards,

Robert

4 comments
Comment actions Permalink

Hi Robert,
Please check if you have annotation processing enabled in your project. Some annotation processors are written so that cause javac fail to resolve some code references, especialy if this is javac from JDK6.
Javac from JDK7 is known to be more stable in this field.

0
Comment actions Permalink

I have installed 1.7.0_51 from Oracle and set it as the project JDK but it is still the same behaviour.

0
Comment actions Permalink

What about annotation processing? Is it used in the project? If yes, what are the processors?

0
Comment actions Permalink

Sorry, I forgot to mention. Annotation processing is disabled for the project. The weird thing is, that I have worked with this project in Intellij well over three months and this suddenly appeared (no IDE version change and no obvious other change I am aware of). I am not 100% sure but I think it appeared in this class that is now causing the compile errors on rebuild after I used optimize imports.

Here again a complete description of the behaviour. I hope it helps.

The first compile error message is:

java: /Users/krueger/repos/de.lesspain.mediatool/de.lesspain.mediatool/src/de/lesspain/mediatool/browser/BrowseViewPartImpl.java:905: cannot find symbol
symbol  : class JButton
location: class de.lesspain.mediatool.browser.BrowseViewPartImpl

The code that causes this is a class declaration:

public static class DirectionJButton extends JButton {
...

All others are almost certainly caused by JButton not being resolved.

import javax.swing.JButton;

is in the file. Within the editor JButton seems to be resolved because it links to JButton code and displays the class declaration tooltip. Using "Make Project" for compilation works fine.

Weird, isn't it?

0

Please sign in to leave a comment.