Run automatic Java 8 conversion over codebase

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171174380
This commit is contained in:
mcilwain 2017-10-05 10:48:38 -07:00 committed by Ben McIlwain
parent 44df5da771
commit 5edb7935ed
190 changed files with 2312 additions and 3096 deletions

View file

@ -95,21 +95,19 @@ final class Router {
}
private static Function<Object, ?> newInstantiator(final Method method) {
return new Function<Object, Object>() {
@Override
public Object apply(Object component) {
try {
return method.invoke(component);
} catch (IllegalAccessException e) {
throw new RuntimeException(
"Error reflectively accessing component's @Action factory method", e);
} catch (InvocationTargetException e) {
// This means an exception was thrown during the injection process while instantiating
// the @Action class; we should propagate that underlying exception.
throwIfUnchecked(e.getCause());
throw new AssertionError(
"Component's @Action factory method somehow threw checked exception", e);
}
}};
return component -> {
try {
return method.invoke(component);
} catch (IllegalAccessException e) {
throw new RuntimeException(
"Error reflectively accessing component's @Action factory method", e);
} catch (InvocationTargetException e) {
// This means an exception was thrown during the injection process while instantiating
// the @Action class; we should propagate that underlying exception.
throwIfUnchecked(e.getCause());
throw new AssertionError(
"Component's @Action factory method somehow threw checked exception", e);
}
};
}
}