1*2167191dSAndroid Build Coastguard Worker /* 2*2167191dSAndroid Build Coastguard Worker * Copyright 2022 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.NullMarked; 17*2167191dSAndroid Build Coastguard Worker import org.jspecify.annotations.Nullable; 18*2167191dSAndroid Build Coastguard Worker import org.jspecify.annotations.NullnessUnspecified; 19*2167191dSAndroid Build Coastguard Worker 20*2167191dSAndroid Build Coastguard Worker @NullMarked 21*2167191dSAndroid Build Coastguard Worker interface WildcardBoundWithAnnotations { use(Supplier<? extends T> s, Lib<T> l)22*2167191dSAndroid Build Coastguard Worker <T> void use(Supplier<? extends T> s, Lib<T> l); 23*2167191dSAndroid Build Coastguard Worker useUnspec(Supplier<? extends @NullnessUnspecified T> s, Lib<T> l)24*2167191dSAndroid Build Coastguard Worker <T> void useUnspec(Supplier<? extends @NullnessUnspecified T> s, Lib<T> l); 25*2167191dSAndroid Build Coastguard Worker useUnionNull(Supplier<? extends @Nullable T> s, Lib<T> l)26*2167191dSAndroid Build Coastguard Worker <T> void useUnionNull(Supplier<? extends @Nullable T> s, Lib<T> l); 27*2167191dSAndroid Build Coastguard Worker x0(Supplier<? extends T> s, Lib<T> l)28*2167191dSAndroid Build Coastguard Worker default <T> void x0(Supplier<? extends T> s, Lib<T> l) { 29*2167191dSAndroid Build Coastguard Worker use(s, l); 30*2167191dSAndroid Build Coastguard Worker useUnspec(s, l); 31*2167191dSAndroid Build Coastguard Worker useUnionNull(s, l); 32*2167191dSAndroid Build Coastguard Worker } 33*2167191dSAndroid Build Coastguard Worker x1(Supplier<? extends @NullnessUnspecified T> s, Lib<T> l)34*2167191dSAndroid Build Coastguard Worker default <T> void x1(Supplier<? extends @NullnessUnspecified T> s, Lib<T> l) { 35*2167191dSAndroid Build Coastguard Worker // jspecify_nullness_not_enough_information 36*2167191dSAndroid Build Coastguard Worker use(s, l); 37*2167191dSAndroid Build Coastguard Worker // jspecify_nullness_not_enough_information 38*2167191dSAndroid Build Coastguard Worker useUnspec(s, l); 39*2167191dSAndroid Build Coastguard Worker useUnionNull(s, l); 40*2167191dSAndroid Build Coastguard Worker } 41*2167191dSAndroid Build Coastguard Worker x2(Supplier<? extends @Nullable T> s, Lib<T> l)42*2167191dSAndroid Build Coastguard Worker default <T> void x2(Supplier<? extends @Nullable T> s, Lib<T> l) { 43*2167191dSAndroid Build Coastguard Worker // jspecify_nullness_mismatch 44*2167191dSAndroid Build Coastguard Worker use(s, l); 45*2167191dSAndroid Build Coastguard Worker // jspecify_nullness_not_enough_information 46*2167191dSAndroid Build Coastguard Worker useUnspec(s, l); 47*2167191dSAndroid Build Coastguard Worker useUnionNull(s, l); 48*2167191dSAndroid Build Coastguard Worker } 49*2167191dSAndroid Build Coastguard Worker 50*2167191dSAndroid Build Coastguard Worker interface Supplier<T extends @Nullable Object> {} 51*2167191dSAndroid Build Coastguard Worker 52*2167191dSAndroid Build Coastguard Worker interface Lib<T> {} 53*2167191dSAndroid Build Coastguard Worker } 54