Debian Codegraph @

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