-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:error-handlingIssues tied with how exceptions are handled, tried, thrown and caught.Issues tied with how exceptions are handled, tried, thrown and caught.compat:javaitype:language enhancementneeds-sipA SIP needs to be raised to move this issue/PR along.A SIP needs to be raised to move this issue/PR along.
Description
Compiler version
3.3.6
Minimized code
@throws[T]
def sneakyThrow[T <: Throwable, R](t: Throwable): R = {
throw t.asInstanceOf[T]
}Output
[error] /Users/hepin/IdeaProjects/pekko/actor/src/main/scala/org/apache/pekko/japi/Throwables.scala:60:13: not found: type T
[error] @throws[T]
[error] ^Expectation
Compiles as Java
static <T extends Throwable, R> R sneakyThrow(Throwable t) throws T {
throw (T) t;
}I can write :
def sneakyThrow[T <: Throwable, R](t: Throwable): R = {
throw t.asInstanceOf[T]
}Metadata
Metadata
Assignees
Labels
area:error-handlingIssues tied with how exceptions are handled, tried, thrown and caught.Issues tied with how exceptions are handled, tried, thrown and caught.compat:javaitype:language enhancementneeds-sipA SIP needs to be raised to move this issue/PR along.A SIP needs to be raised to move this issue/PR along.