Does @inheritDoc work for IntelliJ IDEA 10?

Hello,

given the following java class:

public class MyClass {


     /**
       * {@inheritDoc}
       */
      @Override
      public String toString() {
           return super.toString();
      }


}

When I set the cursor on the MyClass::toString() method there's no documentation inherited from the Object class. Do I miss something?

Greetings
- Marcel
8 comments
Comment actions Permalink

Hello Marcel,

To see the JavaDoc of a class or a method, press Ctrl-Q (Quick Documentation
Popup).

given the following java class:

public class MyClass {

/**

  • {@inheritDoc}

*/
@Override
public String toString() {
return super.toString();
}
}
When I set the cursor on the MyClass::toString() method there's no
documentation inherited from the Object class. Do I miss something?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Of course I did press Ctrl+Q - I'm used to it that's why I'm wondering why the doc isn't inherited on my side.

0
Comment actions Permalink

Hello Marcel,

Is the source code attached to your JDK? @inheritDoc works just fine for me.

Of course I did press Ctrl+Q - I'm used to it that's why I'm wondering
why the doc isn't inherited on my side.


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Yes, the source code is attached. I just figured out that when I explicitly add "extends Object" it'll work! Maybe this should be fixed for future versions.

0
Comment actions Permalink

Please also note that a comment that is empty except for {@inheritDoc} is completely superfluous on a method.
By specification Javadoc (and IDEA) will automatically copy the super's comment anyway in that case.
You only need to use @inherit doc for constructors, fields and nested classes or when you want to specify a comment plus insert the superclass comment at a specific point.

On 01.04.2011 17:09, Marcel Karras wrote:

Hello,

>

given the following java class:

>

public class MyClass {

>
>

      /**
       

  • {@inheritDoc}

        */
       @Override
       public String toString() {
            return super.toString();
       }
}

>

When I set the cursor on the MyClass::toString() method there's no documentation inherited from the Object class. Do I miss something?

>

Greetings
- Marcel

>

---
Original message URL: http://devnet.jetbrains.net/message/5299069#5299069


0
Comment actions Permalink

Hello Stephen,

yes, I'm aware of the approach using @inheritDoc - maybe my example is stripped off too much but the problem remains the same, with or without additional documentation for the overridden method.

0
Comment actions Permalink

I guess you should never extend Object. So far, I haven't found a project with coding guidelines that considered this to be a good thing.

0
Comment actions Permalink

Noone suggests extending a common class from "Object" - if you'd read the whole post you should have recognized that the "extends Object" issue was just a "test" to "enforce" the javadoc inheritance. There's of course no sense in extending the Object class at all.

0

Please sign in to leave a comment.