RFR [8037866] Replace the Fun class in tests with lambdas
Remi Forax
forax at univ-mlv.fr
Mon Jun 2 10:46:00 UTC 2014
On 06/02/2014 06:36 AM, Martin Buchholz wrote:
> Thanks! Looks good.
> There might be more common infrastructure to take advantage of later.
> @FunctionalInterface is not really in the spirit of my super-compact
> stylistically odd test code, but OK.
Another question is why not to use a functional interface with one
parameter (Fun2?)
or keep Fun and introduce Fun2.
//interface Fun {void f() throws Throwable;}
interface Fun2<T> {void f(T value) throws Throwable;}
THROWS(BrokenBarrierException.class, barrier, x ->x.await(100, MILISECOND));
THROWS(IllegalStateException.class, it, Iterator::remove);
with the nice advantage that most of the time the lambda will be constant
(a lambda that's not capture value from the outer context).
Rémi
>
>
>
>
> On Sun, Jun 1, 2014 at 5:57 PM, Ivan Gerasimov <ivan.gerasimov at oracle.com>
> wrote:
>
>> Hello!
>>
>> Would you please help review the fix, which replaces the auxiliary Fun
>> class with the same named functional interface?
>> The anonymous classes instantiations are replaced with lambdas.
>>
>> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8037866
>> WEBREV: http://cr.openjdk.java.net/~igerasim/8037866/0/webrev/
>>
>> Sincerely yours,
>> Ivan
>>
More information about the core-libs-dev
mailing list