Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5487

Include @throws in Javadoc when thrown exceptions are documented

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.15.0
    • None
    • Java - Compiler
    • None

    Description

      According to the Thrift IDL the declared exceptions of a function are fields and can therefore have a documentation comment. That comment also shows up in the HTML documentation (--gen html). However, in the generated Javadoc the exception documentation is missing. Expected would be that for every declared thrown exception an @throws Javadoc tag is added to the documentation.
      Note that Javadoc supports having multiple @throws tags for the same exception type, so no special care has to be taken for that situation.

      Example

      demo.thrift
      namespace java demo
      
      exception SomeException {
      }
      
      service Demo {
          /** Demo method */
          void doSomething() throws (
              /** first exception */
              1:SomeException e1,
              /** second exception */
              2:SomeException e2
          ),
      }
      

      Expected generated Java code:

      Demo.Iface (expected)
      public interface Iface {
          /**
            * Demo method
            *
            * @throws SomeException first exception
            * @throws SomeException second exception
            */
           public void doSomething() throws SomeException, SomeException, org.apache.thrift.TException;
      }
      

      Actually generated code

      Demo.Iface (actual)
      public interface Iface {
          /**
            * Demo method
            */
           public void doSomething() throws SomeException, SomeException, org.apache.thrift.TException;
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Marcono1234 Marcono1234
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: