Repository: aurora Updated Branches: refs/heads/master d6b2c7e33 -> c87113337
Remove ExceptionalClosure interface. Reviewed at https://reviews.apache.org/r/38039/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/c8711333 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/c8711333 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/c8711333 Branch: refs/heads/master Commit: c87113337a6b3714b1cd061688f5d52aa9abc3a4 Parents: d6b2c7e Author: Zameer Manji <[email protected]> Authored: Wed Sep 2 12:07:24 2015 -0700 Committer: Zameer Manji <[email protected]> Committed: Wed Sep 2 12:07:24 2015 -0700 ---------------------------------------------------------------------- .../org/apache/aurora/common/base/Closure.java | 10 +++++- .../aurora/common/base/ExceptionalClosure.java | 35 -------------------- .../apache/aurora/common/base/ClosuresTest.java | 5 --- 3 files changed, 9 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/c8711333/commons/src/main/java/org/apache/aurora/common/base/Closure.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/base/Closure.java b/commons/src/main/java/org/apache/aurora/common/base/Closure.java index 9467255..42c9d11 100644 --- a/commons/src/main/java/org/apache/aurora/common/base/Closure.java +++ b/commons/src/main/java/org/apache/aurora/common/base/Closure.java @@ -20,6 +20,14 @@ package org.apache.aurora.common.base; * * @author John Sirois */ -public interface Closure<T> extends ExceptionalClosure<T, RuntimeException> { +@FunctionalInterface +public interface Closure<T> { // convenience typedef + + /** + * Performs a unit of work on item + * + * @param item the item to perform work against + */ + void execute(T item); } http://git-wip-us.apache.org/repos/asf/aurora/blob/c8711333/commons/src/main/java/org/apache/aurora/common/base/ExceptionalClosure.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/base/ExceptionalClosure.java b/commons/src/main/java/org/apache/aurora/common/base/ExceptionalClosure.java deleted file mode 100644 index 66b3314..0000000 --- a/commons/src/main/java/org/apache/aurora/common/base/ExceptionalClosure.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.base; - -/** - * An interface that captures a unit of work against an item. - * - * @param <T> The closure type. - * @param <E> The exception type thrown by the closure. - * - * @author John Sirois - */ -public interface ExceptionalClosure<T, E extends Exception> { - - /** - * Performs a unit of work on item, possibly throwing {@code E} in the process. - * - * <p>TODO(John Sirois): consider supporting @Nullable - * - * @param item the item to perform work against - * @throws E if there was a problem performing the work - */ - void execute(T item) throws E; -} http://git-wip-us.apache.org/repos/asf/aurora/blob/c8711333/commons/src/test/java/org/apache/aurora/common/base/ClosuresTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/base/ClosuresTest.java b/commons/src/test/java/org/apache/aurora/common/base/ClosuresTest.java index 574ab40..07bf23c 100644 --- a/commons/src/test/java/org/apache/aurora/common/base/ClosuresTest.java +++ b/commons/src/test/java/org/apache/aurora/common/base/ClosuresTest.java @@ -13,8 +13,6 @@ */ package org.apache.aurora.common.base; -import java.io.IOException; - import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; @@ -31,9 +29,6 @@ import static org.junit.Assert.fail; public class ClosuresTest extends EasyMockTest { private static final Clazz<Closure<Integer>> INT_CLOSURE_CLZ = new Clazz<Closure<Integer>>() { }; - private static final Clazz<ExceptionalClosure<Integer, IOException>> EXC_INT_CLOSURE_CLZ = - new Clazz<ExceptionalClosure<Integer, IOException>>() { }; - static class Thrown extends RuntimeException { } @Test
