You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "PavelTurk (via GitHub)" <gi...@apache.org> on 2023/11/17 17:23:35 UTC

[I] Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code [netbeans]

PavelTurk opened a new issue, #6718:
URL: https://github.com/apache/netbeans/issues/6718

   ### Description
   
   I suggest to add `{@inheritDoc}` inline tag whenever code generated by NB contains `@Override` method. 
   
   For example, we have `A` class:
   
   ```
   public class A {
   
       /**
        * Does it.
        *
        * Does it as no one else.
        *
        * @param foo
        * @return string if everything is ok.
        */
       public String doIt(int foo) {
           return null;
       }
   }
   ```
   Now we want to override `doIt` method in `B` class. So,
   
   ```
   public class B extends A {
   
      //here Alt+Insert -> Override method -> select doIt. The following code must be generated:
   
       /**
        * {@inheritDoc}
        */
       @Override
       public String doIt(int a) {
           return super.doIt(a);
       }
   }
   ```
   The same is for interfaces implementations.
   
   ### Use case/motivation
   
   In most cases Javadoc comments are provided in interfaces or parent classes while implementation and child classes take these comments from interfaces or parent classes.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code [netbeans]

Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on issue #6718:
URL: https://github.com/apache/netbeans/issues/6718#issuecomment-2114684367

   I agree with @mbien , many cases will not be exposed.  And having `{@inheritDoc}` inserted _without_ additional text seems like an antipattern to me.  What's the point?  Doesn't adding this also stop the automatic inheritance of docs for param and return in the example?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code [netbeans]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on issue #6718:
URL: https://github.com/apache/netbeans/issues/6718#issuecomment-1817490088

   I am not sure about this. Probably 90% of all methods I override shouldn't even have javadoc since there are non public or internal, inner classes for example, where the impl it not exposed while the super class or interface is - it would only cause noise.
   
   Adding `inheritDoc` by default over every `@Override` will likely also cause problems when project dependencies are overwritten since the javadoc tool requires access to the full dependency source tree to be able to inherit javadoc.
   
   There is a reason the javadoc tool does not inherit doc by default and requires the inheritDoc tag, I think IDEs should also not add this tag blindly. It is a manual step for specific situations.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code [netbeans]

Posted by "PavelTurk (via GitHub)" <gi...@apache.org>.
PavelTurk commented on issue #6718:
URL: https://github.com/apache/netbeans/issues/6718#issuecomment-2114617986

   @mbien I think that JDK-8287152 gives more flebixility and NB should support it. As I understand it correctly we can do the following:
   
   ```
       /**
        * {@inheritDoc CTRL + SPACE -> list of classes/interfaces from which developer can select one item}   
        */
       @Override
       public String doIt(int a) {
           return super.doIt(a);
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code [netbeans]

Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on issue #6718:
URL: https://github.com/apache/netbeans/issues/6718#issuecomment-2115467982

   I incline to what @mbien, but I would like to ask more about the motivation - what's the purpose? My understanding is that if a method overrides a method from a supertype, and has no javadoc comment whatsoever, the javadoc text from the supertype's method is used automatically. I just tried, and it worked for me. So, what's the goal of trying to add `{@inheritDoc}`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code [netbeans]

Posted by "PavelTurk (via GitHub)" <gi...@apache.org>.
PavelTurk commented on issue #6718:
URL: https://github.com/apache/netbeans/issues/6718#issuecomment-2114436401

   @mbien Thank you for link to JDK-8287152. I didn't know but it is great news. When we select method to override we select this method from a form where they are listed by class:
   
   ![Screenshot from 2024-05-16 11-16-48](https://github.com/apache/netbeans/assets/10261361/0a2208c5-8508-4664-9432-c7a8d6ce6961)
   
   
   So, we can easily generate this javadoc  `{@inheritDoc <class-or-interface>}`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code [netbeans]

Posted by "PavelTurk (via GitHub)" <gi...@apache.org>.
PavelTurk closed issue #6718: Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code
URL: https://github.com/apache/netbeans/issues/6718


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] Add {@inheritDoc} to javadoc comments when `@Override` annotation exists in generated code [netbeans]

Posted by "PavelTurk (via GitHub)" <gi...@apache.org>.
PavelTurk commented on issue #6718:
URL: https://github.com/apache/netbeans/issues/6718#issuecomment-2115540065

   I am not sure about this issue after @mbien comment about JDK-8287152. So, for now I am closing it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists