xref: /aosp_15_r20/external/jspecify/samples/NotNullMarkedAnnotatedInnerOfParameterized.java (revision 2167191df2fa07300797f1ac5b707370b5f38c48)
1*2167191dSAndroid Build Coastguard Worker /*
2*2167191dSAndroid Build Coastguard Worker  * Copyright 2020 The JSpecify Authors.
3*2167191dSAndroid Build Coastguard Worker  *
4*2167191dSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*2167191dSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*2167191dSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*2167191dSAndroid Build Coastguard Worker  *
8*2167191dSAndroid Build Coastguard Worker  *     http://www.apache.org/licenses/LICENSE-2.0
9*2167191dSAndroid Build Coastguard Worker  *
10*2167191dSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*2167191dSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*2167191dSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*2167191dSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*2167191dSAndroid Build Coastguard Worker  * limitations under the License.
15*2167191dSAndroid Build Coastguard Worker  */
16*2167191dSAndroid Build Coastguard Worker import org.jspecify.annotations.Nullable;
17*2167191dSAndroid Build Coastguard Worker 
18*2167191dSAndroid Build Coastguard Worker abstract class NotNullMarkedAnnotatedInnerOfParameterized<T> {
19*2167191dSAndroid Build Coastguard Worker   interface Lib<T extends @Nullable Object> {}
20*2167191dSAndroid Build Coastguard Worker 
21*2167191dSAndroid Build Coastguard Worker   class Nested {
22*2167191dSAndroid Build Coastguard Worker     class DoublyNested {}
23*2167191dSAndroid Build Coastguard Worker   }
24*2167191dSAndroid Build Coastguard Worker 
foo( @ullable Nested x4, @Nullable NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested x5, NotNullMarkedAnnotatedInnerOfParameterized<?>.@Nullable Nested x6, @Nullable NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested.DoublyNested x7, NotNullMarkedAnnotatedInnerOfParameterized<?>.@Nullable Nested.DoublyNested x8, NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested.@Nullable DoublyNested x9, Lib<@Nullable NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested.DoublyNested> l1, Lib<NotNullMarkedAnnotatedInnerOfParameterized<?>.@Nullable Nested.DoublyNested> l2, Lib<NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested.DoublyNested> l3)25*2167191dSAndroid Build Coastguard Worker   void foo(
26*2167191dSAndroid Build Coastguard Worker       @Nullable Nested x4,
27*2167191dSAndroid Build Coastguard Worker 
28*2167191dSAndroid Build Coastguard Worker       // jspecify_nullness_intrinsically_not_nullable
29*2167191dSAndroid Build Coastguard Worker       @Nullable NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested x5,
30*2167191dSAndroid Build Coastguard Worker       NotNullMarkedAnnotatedInnerOfParameterized<?>.@Nullable Nested x6,
31*2167191dSAndroid Build Coastguard Worker 
32*2167191dSAndroid Build Coastguard Worker       // jspecify_nullness_intrinsically_not_nullable
33*2167191dSAndroid Build Coastguard Worker       @Nullable NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested.DoublyNested x7,
34*2167191dSAndroid Build Coastguard Worker 
35*2167191dSAndroid Build Coastguard Worker       // jspecify_nullness_intrinsically_not_nullable
36*2167191dSAndroid Build Coastguard Worker       NotNullMarkedAnnotatedInnerOfParameterized<?>.@Nullable Nested.DoublyNested x8,
37*2167191dSAndroid Build Coastguard Worker       NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested.@Nullable DoublyNested x9,
38*2167191dSAndroid Build Coastguard Worker 
39*2167191dSAndroid Build Coastguard Worker       // jspecify_nullness_intrinsically_not_nullable
40*2167191dSAndroid Build Coastguard Worker       Lib<@Nullable NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested.DoublyNested> l1,
41*2167191dSAndroid Build Coastguard Worker 
42*2167191dSAndroid Build Coastguard Worker       // jspecify_nullness_intrinsically_not_nullable
43*2167191dSAndroid Build Coastguard Worker       Lib<NotNullMarkedAnnotatedInnerOfParameterized<?>.@Nullable Nested.DoublyNested> l2,
44*2167191dSAndroid Build Coastguard Worker       Lib<NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested.DoublyNested> l3) {}
45*2167191dSAndroid Build Coastguard Worker 
create(Nested n)46*2167191dSAndroid Build Coastguard Worker   Nested.DoublyNested create(Nested n) {
47*2167191dSAndroid Build Coastguard Worker     return n.new DoublyNested();
48*2167191dSAndroid Build Coastguard Worker   }
49*2167191dSAndroid Build Coastguard Worker 
50*2167191dSAndroid Build Coastguard Worker   // jspecify_nullness_intrinsically_not_nullable
returnType()51*2167191dSAndroid Build Coastguard Worker   abstract @Nullable NotNullMarkedAnnotatedInnerOfParameterized<?>.Nested returnType();
52*2167191dSAndroid Build Coastguard Worker }
53