File: WildcardCharPrimitive.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,104 kB
  • sloc: java: 145,916; xml: 839; sh: 518; makefile: 404; perl: 26
file content (24 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class WildcardCharPrimitive {
    static interface Predicate<T> {
        boolean apply(T t);
    }

    abstract static class Matcher {

        public abstract boolean matches(char character);
    }

    public static void forPredicate(final Predicate<? super Character> predicate) {

        new Matcher() {
            //  this tests default type hierarchy visitPrimitive_Wildcard
            public boolean matches(char c) {
                //  this will happen when a type system does not have an EXPLICIT_LOWER_BOUND
                //  that matches the default for char c
                @SuppressWarnings("argument.type.incompatible")
                boolean value = predicate.apply(c);
                return value;
            }
        };
    }
}