Debian Codegraph @

checker/tests/nullness/java8/Issue496.java

raw
1 // Test case for issue 496:
2 // https://github.com/typetools/checker-framework/issues/496
3
4 import java.util.Optional;
5
6 class Issue496 {
7
8 public static class Entity<T> {
9 public final T value;
10 public final Class<T> cls;
11
12 public Entity(T value, Class<T> cls) {
13 this.value = value;
14 this.cls = cls;
15 }
16 }
17
18 public static <T> Optional<Entity<T>> testCase(Class<T> targetClass) {
19 return Optional.<T>empty().map((T val) -> new Entity<T>(val, targetClass));
20 }
21 }