Meaning of the bound of the form `throws α` during Type Inference in Java

Viewed 32

According to JLS (§18.1.3)"Bounds" : it specifies regarding the inference of throws α:

A bound of the form throws α is purely informational: it directs resolution to optimize the instantiation of α so that, if possible, it is not a checked exception type.

  • this tells that α must be Optimized to be Instantiated as an Unchecked Exception Type.

But in the JLS (§18.1.2) "Constraint Formulas" : from which the bounds will be inferred as subsequent step:

‹LambdaExpression →throws T›: The checked exceptions thrown by the body of the LambdaExpression are declared by the throws clause of the function type derived from T.

  • this tells that α represents an Instantiation of a Checked Exception Type.

Regarding the Instantiations of α there are 2 conflicting thoughts being presented. Am I missing something here?

0 Answers
Related