spring cleaning in the lambda (langtools) repository
Dan Smith
daniel.smith at oracle.com
Wed Apr 11 11:22:49 PDT 2012
Hi Neal,
Are you just talking about the fact that, in the spec, functional interfaces can have a "throws" clause? If not, can you point me to the spec examples of exception-transparent SAMs and lambdas that you mention? (I'd like to make sure they accurately reflect the expected behavior.)
The experimental feature involved special syntax to support type parameters that represent lists of checked exceptions. This special syntax has been removed.
There is still some degree of "exception transparency" available, depending on how you define the term. For example, the (under development) inference spec makes some effort to produce something useful when an inference variable appears in a functional interface's "throws" clause:
interface Thunk<T,E> {
T get() throws E;
}
<T,E> T get(Thunk<T,E> thunk) throws E;
get(() -> new FileReader("/usr/local")); // 'get' throws IOException
(Not sure whether the current implementation handles this correctly or not.)
Features like the experimental one that was removed from the compiler are designed to expand on this basic behavior by generalizing to lists of exceptions (possibly including empty lists) and/or minimizing the syntactic burden when the type is mentioned. Neither the current EDR nor the next iteration (coming soon) includes such a feature, although we haven't shut the door on getting to something like that eventually.
—Dan
On Apr 10, 2012, at 4:33 PM, Neal Gafter wrote:
> Maurizio-
>
> You listed removal of "experimental support for exception transparency" as
> one of the changes to bring the implementation in line with the latest spec
> EDR, but I don't remember seeing that in your preceding email listing the
> differences between the implementation and the specification. The EDR does
> not say how exceptions play into type inference (the entire type inference
> section is "Still under development"), but it certainly does show examples
> of apparently exception-transparent SAMs and lambdas. Can you please tell
> us what has changed?
>
> Cheers,
> Neal
>
> On Tue, Apr 10, 2012 at 9:39 AM, Maurizio Cimadamore <
> maurizio.cimadamore at oracle.com> wrote:
>
>> Hi,
>> in the past week I've been busy cleaning up the langtools lambda
>> repository. The goal of this work is to minimize differences between the
>> JDK 8 repository and the lambda repository - as you all know, we've been
>> working for the last two year in the lambda branch, we went back and
>> forth on few items and that cause the two codebases to diverge a little
>> bit. It is also time to bring the code in sync with the latest spec EDR
>> (more on that below).
>>
>> The cleanup focus on the following areas:
>>
>> *) Remove experimental support for exception transparency
>> ...
>
More information about the lambda-dev
mailing list