xref: /aosp_15_r20/external/jspecify/samples/NotNullMarkedAnnotatedInnerOfNonParameterized.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.Nullable;
17 
18 abstract class NotNullMarkedAnnotatedInnerOfNonParameterized {
19   interface Lib<T extends @Nullable Object> {}
20 
21   class Nested {
22     class DoublyNested {}
23   }
24 
foo( @ullable Nested x4, @Nullable NotNullMarkedAnnotatedInnerOfNonParameterized.Nested x5, NotNullMarkedAnnotatedInnerOfNonParameterized.@Nullable Nested x6, @Nullable NotNullMarkedAnnotatedInnerOfNonParameterized.Nested.DoublyNested x7, NotNullMarkedAnnotatedInnerOfNonParameterized.@Nullable Nested.DoublyNested x8, NotNullMarkedAnnotatedInnerOfNonParameterized.Nested.@Nullable DoublyNested x9, Lib<@Nullable NotNullMarkedAnnotatedInnerOfNonParameterized.Nested.DoublyNested> l1, Lib<NotNullMarkedAnnotatedInnerOfNonParameterized.@Nullable Nested.DoublyNested> l2, Lib<NotNullMarkedAnnotatedInnerOfNonParameterized.Nested.DoublyNested> l3)25   void foo(
26       @Nullable Nested x4,
27 
28       // jspecify_nullness_intrinsically_not_nullable
29       @Nullable NotNullMarkedAnnotatedInnerOfNonParameterized.Nested x5,
30       NotNullMarkedAnnotatedInnerOfNonParameterized.@Nullable Nested x6,
31 
32       // jspecify_nullness_intrinsically_not_nullable
33       @Nullable NotNullMarkedAnnotatedInnerOfNonParameterized.Nested.DoublyNested x7,
34 
35       // jspecify_nullness_intrinsically_not_nullable
36       NotNullMarkedAnnotatedInnerOfNonParameterized.@Nullable Nested.DoublyNested x8,
37       NotNullMarkedAnnotatedInnerOfNonParameterized.Nested.@Nullable DoublyNested x9,
38 
39       // jspecify_nullness_intrinsically_not_nullable
40       Lib<@Nullable NotNullMarkedAnnotatedInnerOfNonParameterized.Nested.DoublyNested> l1,
41 
42       // jspecify_nullness_intrinsically_not_nullable
43       Lib<NotNullMarkedAnnotatedInnerOfNonParameterized.@Nullable Nested.DoublyNested> l2,
44       Lib<NotNullMarkedAnnotatedInnerOfNonParameterized.Nested.DoublyNested> l3) {}
45 
create(Nested n)46   Nested.DoublyNested create(Nested n) {
47     return n.new DoublyNested();
48   }
49 
50   // jspecify_nullness_intrinsically_not_nullable
returnType()51   abstract @Nullable NotNullMarkedAnnotatedInnerOfNonParameterized.Nested returnType();
52 }
53