You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Marcono1234 (Jira)" <ji...@apache.org> on 2021/12/04 16:10:00 UTC

[jira] [Created] (THRIFT-5487) Include @throws in Javadoc when thrown exceptions are documented

Marcono1234 created THRIFT-5487:
-----------------------------------

             Summary: Include @throws in Javadoc when thrown exceptions are documented
                 Key: THRIFT-5487
                 URL: https://issues.apache.org/jira/browse/THRIFT-5487
             Project: Thrift
          Issue Type: Improvement
          Components: Java - Compiler
    Affects Versions: 0.15.0
            Reporter: Marcono1234


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.

h3. Example
{code:none|title=demo.thrift}
namespace java demo

exception SomeException {
}

service Demo {
    /** Demo method */
    void doSomething() throws (
        /** first exception */
        1:SomeException e1,
        /** second exception */
        2:SomeException e2
    ),
}
{code}

Expected generated Java code:
{code:title=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;
}
{code}

Actually generated code
{code:title=Demo.Iface (actual)}
public interface Iface {
    /**
      * Demo method
      */
     public void doSomething() throws SomeException, SomeException, org.apache.thrift.TException;
}
{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)