Debian Codegraph @

samples/TypeArgumentOfWildcardBound.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 TypeArgumentOfWildcardBound {
22 interface Supplier<T extends @Nullable Object> {
23 T get();
24 }
25
26 Supplier<Object> x1(Supplier<? extends Supplier<Object>> s) {
27 return s.get();
28 }
29
30 Supplier<@NullnessUnspecified Object> x2(Supplier<? extends Supplier<Object>> s) {
31 // jspecify_nullness_not_enough_information
32 return s.get();
33 }
34
35 Supplier<@Nullable Object> x3(Supplier<? extends Supplier<Object>> s) {
36 // jspecify_nullness_mismatch
37 return s.get();
38 }
39
40 Supplier<Object> x4(Supplier<? extends Supplier<@NullnessUnspecified Object>> s) {
41 // jspecify_nullness_not_enough_information
42 return s.get();
43 }
44
45 Supplier<@NullnessUnspecified Object> x5(
46 Supplier<? extends Supplier<@NullnessUnspecified Object>> s) {
47 // jspecify_nullness_not_enough_information
48 return s.get();
49 }
50
51 Supplier<@Nullable Object> x6(Supplier<? extends Supplier<@NullnessUnspecified Object>> s) {
52 // jspecify_nullness_not_enough_information
53 return s.get();
54 }
55
56 Supplier<Object> x7(Supplier<? extends Supplier<@Nullable Object>> s) {
57 // jspecify_nullness_mismatch
58 return s.get();
59 }
60
61 Supplier<@NullnessUnspecified Object> x8(Supplier<? extends Supplier<@Nullable Object>> s) {
62 // jspecify_nullness_not_enough_information
63 return s.get();
64 }
65
66 Supplier<@Nullable Object> x9(Supplier<? extends Supplier<@Nullable Object>> s) {
67 return s.get();
68 }
69 }