diff options
author | Paul Duffin <paulduffin@google.com> | 2017-02-08 11:56:54 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-02-08 11:56:54 +0000 |
commit | 9432ade17c16656f8c3ebbe2b7f3081a93c52d4d (patch) | |
tree | 20450ddaeccffed3d7254a742f253632088ea102 | |
parent | 05e68aaf5378b155cc99e7c2b8b87de92011c5ce (diff) | |
parent | a7b13a9be885f7471bd449ddaa57ff7a92114c0b (diff) | |
download | hamcrest-9432ade17c16656f8c3ebbe2b7f3081a93c52d4d.tar.gz |
Merge "Temporarily add void is(Class) to cause compile time errors" am: 21a7b5b68f am: f019c17e68 am: e6442f2604
am: a7b13a9be8
Change-Id: I4e29972dddb17dd667623ba1d9383c80f8b90fc8
-rw-r--r-- | hamcrest-core/src/main/java/org/hamcrest/CoreMatchers.java | 20 | ||||
-rw-r--r-- | hamcrest-library/src/main/java/org/hamcrest/Matchers.java | 24 |
2 files changed, 28 insertions, 16 deletions
diff --git a/hamcrest-core/src/main/java/org/hamcrest/CoreMatchers.java b/hamcrest-core/src/main/java/org/hamcrest/CoreMatchers.java index dd36acb..400a491 100644 --- a/hamcrest-core/src/main/java/org/hamcrest/CoreMatchers.java +++ b/hamcrest-core/src/main/java/org/hamcrest/CoreMatchers.java @@ -25,13 +25,19 @@ public class CoreMatchers { } /** - * This is a shortcut to the frequently used is(instanceOf(SomeClass.class)). - * - * eg. assertThat(cheese, is(instanceOf(Cheddar.class))) - * vs assertThat(cheese, is(Cheddar.class)) - */ - public static org.hamcrest.Matcher<java.lang.Object> is(java.lang.Class<?> type) { - return org.hamcrest.core.Is.is(type); + * Provided to cause compile time error when used in preference to a possible runtime error if + * this was not here. + * + * <p>This method was removed upstream between Hamcrest 1.1 and 1.3 in favour of the + * instanceOf(Class) method. Unfortunately, existing usages of it could still compile against the + * {@link #is(Object)} method instead. Although not every existing usage would compile + * successfully it is possible that some could and that would result in a change in the runtime + * behavior that could be difficult to detect and fix. This change aims to turn any significant + * usage of this method into a compile time error. + * + * @deprecated Use instanceOf(SomeClass.class) instead. + */ + public static void is(java.lang.Class<?> type) { } /** diff --git a/hamcrest-library/src/main/java/org/hamcrest/Matchers.java b/hamcrest-library/src/main/java/org/hamcrest/Matchers.java index ce550b5..2e82aa0 100644 --- a/hamcrest-library/src/main/java/org/hamcrest/Matchers.java +++ b/hamcrest-library/src/main/java/org/hamcrest/Matchers.java @@ -24,15 +24,21 @@ public class Matchers { return org.hamcrest.core.Is.is(value); } - /** - * This is a shortcut to the frequently used is(instanceOf(SomeClass.class)). - * - * eg. assertThat(cheese, is(instanceOf(Cheddar.class))) - * vs assertThat(cheese, is(Cheddar.class)) - */ - public static org.hamcrest.Matcher<java.lang.Object> is(java.lang.Class<?> type) { - return org.hamcrest.core.Is.is(type); - } + /** + * Provided to cause compile time error when used in preference to a possible runtime error if + * this was not here. + * + * <p>This method was removed upstream between Hamcrest 1.1 and 1.3 in favour of the + * instanceOf(Class) method. Unfortunately, existing usages of it could still compile against the + * {@link #is(Object)} method instead. Although not every existing usage would compile + * successfully it is possible that some could and that would result in a change in the runtime + * behavior that could be difficult to detect and fix. This change aims to turn any significant + * usage of this method into a compile time error. + * + * @deprecated Use instanceOf(SomeClass.class) instead. + */ + public static void is(java.lang.Class<?> type) { + } /** * Inverts the rule. |