Debian Codegraph @

samples/UnionTypeArgumentWithUseSite.java

raw
1 /*
2 * Copyright 2020 The JSpecify Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 import org.jspecify.annotations.NullMarked;
17 import org.jspecify.annotations.Nullable;
18 import org.jspecify.annotations.NullnessUnspecified;
19
20 @NullMarked
21 class UnionTypeArgumentWithUseSite {
22 interface Super<T extends @Nullable Object> {
23 void t(T t);
24
25 void tUnspec(@NullnessUnspecified T t);
26
27 void tUnionNull(@Nullable T t);
28 }
29
30 interface Sub extends Super<Object> {
31 @Override
32 void t(Object t);
33
34 @Override
35 // jspecify_nullness_not_enough_information
36 void tUnspec(@NullnessUnspecified Object t);
37
38 @Override
39 void tUnionNull(@Nullable Object t);
40 }
41
42 interface SubUnspec extends Super<@NullnessUnspecified Object> {
43 @Override
44 // jspecify_nullness_not_enough_information
45 void t(@NullnessUnspecified Object t);
46
47 @Override
48 // jspecify_nullness_not_enough_information
49 void tUnspec(@NullnessUnspecified Object t);
50
51 @Override
52 void tUnionNull(@Nullable Object t);
53 }
54
55 interface SubUnionNull extends Super<@Nullable Object> {
56 @Override
57 void t(@Nullable Object t);
58
59 @Override
60 void tUnspec(@Nullable Object t);
61
62 @Override
63 void tUnionNull(@Nullable Object t);
64 }
65
66 interface SubWeaker extends Super<Object> {
67 @Override
68 // jspecify_nullness_not_enough_information
69 void tUnspec(Object t);
70
71 @Override
72 // jspecify_nullness_mismatch
73 void tUnionNull(Object t);
74 }
75
76 interface SubWeakerUnspec extends Super<@NullnessUnspecified Object> {
77 @Override
78 // jspecify_nullness_not_enough_information
79 void t(Object t);
80
81 @Override
82 // jspecify_nullness_not_enough_information
83 void tUnspec(Object t);
84
85 @Override
86 // jspecify_nullness_mismatch
87 void tUnionNull(Object t);
88 }
89
90 interface SubWeakerUnionNull extends Super<@Nullable Object> {
91 @Override
92 // jspecify_nullness_mismatch
93 void t(Object t);
94
95 @Override
96 // jspecify_nullness_mismatch
97 void tUnspec(Object t);
98
99 @Override
100 // jspecify_nullness_mismatch
101 void tUnionNull(Object t);
102 }
103 }