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