Debian Codegraph @

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