Debian Codegraph @

samples/CaptureConvertedUnionNullToOtherUnionNull.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 abstract class CaptureConvertedUnionNullToOtherUnionNull {
22 @Nullable Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
23 return unionNull(x.get());
24 }
25
26 @Nullable Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
27 return unionNull(x.get());
28 }
29
30 @Nullable Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
31 return unionNull(x.get());
32 }
33
34 @Nullable Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
35 return unionNull(x.get());
36 }
37
38 @Nullable Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
39 return unionNull(x.get());
40 }
41
42 @Nullable Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
43 return unionNull(x.get());
44 }
45
46 @Nullable Lib x6(UnspecBounded<? extends Lib> x) {
47 return unionNull(x.get());
48 }
49
50 @Nullable Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
51 return unionNull(x.get());
52 }
53
54 @Nullable Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
55 return unionNull(x.get());
56 }
57
58 @Nullable Lib x9(NullableBounded<? extends Lib> x) {
59 return unionNull(x.get());
60 }
61
62 @Nullable Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
63 return unionNull(x.get());
64 }
65
66 @Nullable Lib x11(NullableBounded<? extends @Nullable Lib> x) {
67 return unionNull(x.get());
68 }
69
70 interface ImplicitlyObjectBounded<T> {
71 T get();
72 }
73
74 interface ExplicitlyObjectBounded<T extends Object> {
75 T get();
76 }
77
78 interface UnspecBounded<T extends @NullnessUnspecified Object> {
79 T get();
80 }
81
82 interface NullableBounded<T extends @Nullable Object> {
83 T get();
84 }
85
86 interface Lib {}
87
88 abstract <T extends @Nullable Object> @Nullable T unionNull(T input);
89 }