1 /*
2  * Copyright 2022 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 package memberselectnonexpression;
17 
18 import org.jspecify.annotations.NullMarked;
19 import org.jspecify.annotations.Nullable;
20 
21 class MemberSelectNonExpressions {
22   @NullMarked
23   static class NullMarkedUsage {
x0()24     static void x0() {
25       int x;
26 
27       Static.x();
28       x = Static.x;
29 
30       MemberSelectNonExpressions.Static.x();
31       x = MemberSelectNonExpressions.Static.x;
32 
33       memberselectnonexpression.MemberSelectNonExpressions.Static.x();
34       x = memberselectnonexpression.MemberSelectNonExpressions.Static.x;
35     }
36 
x1()37     static void x1() {
38       StaticParameterized<Object> s0;
39       MemberSelectNonExpressions.StaticParameterized<Object> s1;
40       memberselectnonexpression.MemberSelectNonExpressions.StaticParameterized<Object> s2;
41 
42       StaticParameterized<Object>.Inner i0;
43       MemberSelectNonExpressions.StaticParameterized<Object>.Inner i1;
44       memberselectnonexpression.MemberSelectNonExpressions.StaticParameterized<Object>.Inner i2;
45     }
46   }
47 
48   static class NotNullMarkedUsage {
x0()49     static void x0() {
50       int x;
51 
52       Static.x();
53       x = Static.x;
54 
55       MemberSelectNonExpressions.Static.x();
56       x = MemberSelectNonExpressions.Static.x;
57 
58       memberselectnonexpression.MemberSelectNonExpressions.Static.x();
59       x = memberselectnonexpression.MemberSelectNonExpressions.Static.x;
60     }
61 
x1()62     static void x1() {
63       StaticParameterized<Object> s0;
64       MemberSelectNonExpressions.StaticParameterized<Object> s1;
65       memberselectnonexpression.MemberSelectNonExpressions.StaticParameterized<Object> s2;
66 
67       StaticParameterized<Object>.Inner i0;
68       MemberSelectNonExpressions.StaticParameterized<Object>.Inner i1;
69       memberselectnonexpression.MemberSelectNonExpressions.StaticParameterized<Object>.Inner i2;
70     }
71   }
72 
73   static class Static {
x()74     static void x() {}
75 
76     static int x;
77   }
78 
79   static class StaticParameterized<T extends @Nullable Object> {
x()80     static void x() {}
81 
82     static int x;
83 
84     class Inner {}
85   }
86 }
87