Why do import statements disappear, as soon as you press Enter

Hi,

In my Java project/Groovy Framework, I can't type in any import statements.  As soon as the import statement is typed, and Enter is pressed, it completely disappears.  There's nothing, not even a code folding situation; it just refuses to persist, in the source code file.

2 comments
Comment actions Permalink

You are not supposed to type imports manually, IntelliJ IDEA will add imports for you automatically from the usages.

What happens is that you have optimize imports on the fly option enabled that removes unused imports.

1
Comment actions Permalink

Yep, I see that now, thanks Serge.

0

Please sign in to leave a comment.