lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-7796) Make reThrow idiom declare return type of Throwable so callers may use it in a way that compiler knows subsequent code is unreachable
Date Fri, 21 Apr 2017 19:33:04 GMT

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

Dawid Weiss commented on LUCENE-7796:
-------------------------------------

That has to be an unchecked exception, Hoss, not Throwable (or the type of argument). The
whole point of the rethrow hack is to rethrow a checked exception from a method that doesn't
declare checked exceptions. 

I scanned the code quickly and the rethrow idiom is actually in a few places (AttributeFactory,
Rethrow, SnowballProgram, IOUtils -- although slightly different here). It'd be a good chance
to clean it up. IOUtils has a slightly different flavor, but all the others use the same idiom.

> Make reThrow idiom declare return type of Throwable so callers may use it in a way that
compiler knows subsequent code is unreachable
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-7796
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7796
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Dawid Weiss
>            Assignee: Dawid Weiss
>            Priority: Trivial
>             Fix For: 6.x, master (7.0)
>
>
> A spinoff from LUCENE-7792: reThrow can be declared to return an unchecked exception
so that callers can choose to use {{throw reThrow(...)}} as an idiom to let the compiler know
any subsequent code will be unreachable.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message