26

My problem is that every time I insert a @link or similar in my Javadoc and complete a class, it inserts the full package path in front of it, even thought the class is already imported. For example if I have

import java.util.List;

and I write {@link Li in some Javadoc, and then completes that by choosing List<E> in the popup that appears, it still completes it to {@link java.util.List}. I'd actually prefer it to be {@link List} in any case, and then have the class imported automatically in any case. Event though I don't need it in the code.

Now why is that? Well, I read the Javadoc in my Java files, I rarely read my imports.

I use IntelliJ IDEA 13.1.3.

beruic
  • 5,517
  • 3
  • 35
  • 59
  • It's quicker to type the word List than Li and select an option from a list... :) – Software Engineer Jun 17 '14 at 15:41
  • Javadoc and imports are completely unrelated. The only way to unambigously refer to a class is by fully qualified name. – Durandal Jun 17 '14 at 17:44
  • @Durandal It may be a bit ambigous at times, but it's more readable, and IntelliJ knows which one is the right one, when I press `[Crtl]+[B]` or `[Crtl]+[Q]` :) – beruic Jun 18 '14 at 09:57

3 Answers3

24

In Preferences > Code Style > Java > Imports, uncheck "Use fully qualified class names in javadoc".

enter image description here

beruic
  • 5,517
  • 3
  • 35
  • 59
7

In Preferences > Code Style > Java > Imports, uncheck "Use fully qualified class names"

Uncheck 'Use fully qualified class names'

kuporific
  • 10,053
  • 3
  • 42
  • 46
  • 5
    Already did that. Doesn't work. However the one below "Use fully qualified class names in javadoc" does. – beruic Jun 18 '14 at 09:48
2

2022 UPDATE

Intellij added a third, smarter option in File | Settings | Editor | Code Style | Java | Imports.

enter image description here

cb4
  • 6,689
  • 7
  • 45
  • 57