Skip to content

Commit

Permalink
Delete deprecated Predicates.assignableFrom(Class). Please use Predic…
Browse files Browse the repository at this point in the history
…ates.subtypeOf(Class) instead.

RELNOTES=Delete deprecated Predicates.assignableFrom(Class).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182953732
  • Loading branch information
kluever authored and cpovirk committed Jan 23, 2018
1 parent 41fa39f commit d57a40e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 66 deletions.
Expand Up @@ -622,13 +622,9 @@ public void testSubtypeOf_interface() {
}

@GwtIncompatible // Predicates.subtypeOf
@SuppressWarnings("deprecation")
public void testSubtypeOf_equality() {
new EqualsTester()
.addEqualityGroup(
Predicates.subtypeOf(Integer.class),
Predicates.subtypeOf(Integer.class),
Predicates.assignableFrom(Integer.class))
.addEqualityGroup(Predicates.subtypeOf(Integer.class))
.addEqualityGroup(Predicates.subtypeOf(Number.class))
.addEqualityGroup(Predicates.subtypeOf(Float.class))
.testEquals();
Expand Down
28 changes: 0 additions & 28 deletions android/guava/src/com/google/common/base/Predicates.java
Expand Up @@ -173,34 +173,6 @@ public static Predicate<Object> instanceOf(Class<?> clazz) {
return new InstanceOfPredicate(clazz);
}

/**
* Returns a predicate that evaluates to {@code true} if the class being tested is assignable
* <b>TO</b> {@code clazz}, that is, if it is a <b>subtype</b> of {@code clazz}. Yes, this method
* is named very incorrectly! Example:
*
* <pre>{@code
* List<Class<?>> classes = Arrays.asList(
* Object.class, String.class, Number.class, Long.class);
* return Iterables.filter(classes, assignableFrom(Number.class));
* }</pre>
*
* The code above returns {@code Number.class} and {@code Long.class}, <b>not</b> {@code
* Number.class} and {@code Object.class} as the name implies!
*
* <p>The returned predicate does not allow null inputs.
*
* @deprecated Use the correctly-named method {@link #subtypeOf} instead. This method is scheduled
* to be removed in April 2018.
* @since 10.0
*/
// TODO(b/72241559): Remove by 2018-04
@GwtIncompatible // Class.isAssignableFrom
@Beta
@Deprecated
public static Predicate<Class<?>> assignableFrom(Class<?> clazz) {
return subtypeOf(clazz);
}

/**
* Returns a predicate that evaluates to {@code true} if the class being tested is assignable to
* (is a subtype of) {@code clazz}. Example:
Expand Down
6 changes: 1 addition & 5 deletions guava-tests/test/com/google/common/base/PredicatesTest.java
Expand Up @@ -622,13 +622,9 @@ public void testSubtypeOf_interface() {
}

@GwtIncompatible // Predicates.subtypeOf
@SuppressWarnings("deprecation")
public void testSubtypeOf_equality() {
new EqualsTester()
.addEqualityGroup(
Predicates.subtypeOf(Integer.class),
Predicates.subtypeOf(Integer.class),
Predicates.assignableFrom(Integer.class))
.addEqualityGroup(Predicates.subtypeOf(Integer.class))
.addEqualityGroup(Predicates.subtypeOf(Number.class))
.addEqualityGroup(Predicates.subtypeOf(Float.class))
.testEquals();
Expand Down
28 changes: 0 additions & 28 deletions guava/src/com/google/common/base/Predicates.java
Expand Up @@ -173,34 +173,6 @@ public static Predicate<Object> instanceOf(Class<?> clazz) {
return new InstanceOfPredicate(clazz);
}

/**
* Returns a predicate that evaluates to {@code true} if the class being tested is assignable
* <b>TO</b> {@code clazz}, that is, if it is a <b>subtype</b> of {@code clazz}. Yes, this method
* is named very incorrectly! Example:
*
* <pre>{@code
* List<Class<?>> classes = Arrays.asList(
* Object.class, String.class, Number.class, Long.class);
* return Iterables.filter(classes, assignableFrom(Number.class));
* }</pre>
*
* The code above returns {@code Number.class} and {@code Long.class}, <b>not</b> {@code
* Number.class} and {@code Object.class} as the name implies!
*
* <p>The returned predicate does not allow null inputs.
*
* @deprecated Use the correctly-named method {@link #subtypeOf} instead. This method is scheduled
* to be removed in April 2018.
* @since 10.0
*/
// TODO(b/72241559): Remove by 2018-04
@GwtIncompatible // Class.isAssignableFrom
@Beta
@Deprecated
public static Predicate<Class<?>> assignableFrom(Class<?> clazz) {
return subtypeOf(clazz);
}

/**
* Returns a predicate that evaluates to {@code true} if the class being tested is assignable to
* (is a subtype of) {@code clazz}. Example:
Expand Down

0 comments on commit d57a40e

Please sign in to comment.