| 1 |
class WildcardCharPrimitive { |
| 2 |
static interface Predicate<T> { |
| 3 |
boolean apply(T t); |
| 4 |
} |
| 5 |
|
| 6 |
abstract static class Matcher { |
| 7 |
|
| 8 |
public abstract boolean matches(char character); |
| 9 |
} |
| 10 |
|
| 11 |
public static void forPredicate(final Predicate<? super Character> predicate) { |
| 12 |
|
| 13 |
new Matcher() { |
| 14 |
// this tests default type hierarchy visitPrimitive_Wildcard |
| 15 |
public boolean matches(char c) { |
| 16 |
// this will happen when a type system does not have an EXPLICIT_LOWER_BOUND |
| 17 |
// that matches the default for char c |
| 18 |
@SuppressWarnings("argument.type.incompatible") |
| 19 |
boolean value = predicate.apply(c); |
| 20 |
return value; |
| 21 |
} |
| 22 |
}; |
| 23 |
} |
| 24 |
} |