You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2015/03/04 22:50:38 UTC

[jira] [Comment Edited] (THRIFT-2935) Exceptions in Java code should not extends TException

    [ https://issues.apache.org/jira/browse/THRIFT-2935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14347623#comment-14347623 ] 

Jens Geyer edited comment on THRIFT-2935 at 3/4/15 9:50 PM:
------------------------------------------------------------

Hi [~mudit], 
just have a look at [this document|http://thrift.apache.org/docs/HowToContribute]. 

*But before you start working*, there should be some consensus about whether or not this should be implemented at all. At least to me it sounds strange to change a *technical* decision based on the particularities of some arbitrary *IDE*. Maybe some Java devs can chime in at this point. 




was (Author: jensg):
Hi [~mudit], 
just have a look at [this document|http://thrift.apache.org/docs/HowToContribute]. 

But before you start working, there should be some consensus about whether or not this should be implemented at all. Maybe some Java devs can chime in at this point.



> Exceptions in Java code should not extends TException
> -----------------------------------------------------
>
>                 Key: THRIFT-2935
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2935
>             Project: Thrift
>          Issue Type: Wish
>          Components: Java - Compiler
>    Affects Versions: 0.9.2
>            Reporter: Sergei Egorov
>              Labels: exception-handling, exceptions, java
>
> Exceptions in Java should not extend TException to avoid collisions on method signature for better IDE support. Currently, if service is throwing some thrift exception, i.e. TMyCustomException, it will have following signature:
> public void myMethod() throws TMyCustomException, TException {
> }
> But TMyCustomException is overlapped by TException,
> Now, if we will call this method in our code:
> client.myMethod();
> IDE will propose to generate try\catch with only 1 block: 
> try {
>    client.myMethod();
> } catch(TException e) {
> }
> Because TMyCustomException extends TException. If TMyCustomException will extends just Exception, than IDE will generate following code:
> try {
>    client.myMethod();
> } catch(TMyCustomException e) {
> } catch(TException e) {
> }
> which is much better, because client caller will know about any custom(!) thrift exception in this method.
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)