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 TypeArgumentOfWildcardBound { 22 interface Supplier<T extends @Nullable Object> { get()23 T get(); 24 } 25 x1(Supplier<? extends Supplier<Object>> s)26 Supplier<Object> x1(Supplier<? extends Supplier<Object>> s) { 27 return s.get(); 28 } 29 x2(Supplier<? extends Supplier<Object>> s)30 Supplier<@NullnessUnspecified Object> x2(Supplier<? extends Supplier<Object>> s) { 31 // jspecify_nullness_not_enough_information 32 return s.get(); 33 } 34 x3(Supplier<? extends Supplier<Object>> s)35 Supplier<@Nullable Object> x3(Supplier<? extends Supplier<Object>> s) { 36 // jspecify_nullness_mismatch 37 return s.get(); 38 } 39 x4(Supplier<? extends Supplier<@NullnessUnspecified Object>> s)40 Supplier<Object> x4(Supplier<? extends Supplier<@NullnessUnspecified Object>> s) { 41 // jspecify_nullness_not_enough_information 42 return s.get(); 43 } 44 x5( Supplier<? extends Supplier<@NullnessUnspecified Object>> s)45 Supplier<@NullnessUnspecified Object> x5( 46 Supplier<? extends Supplier<@NullnessUnspecified Object>> s) { 47 // jspecify_nullness_not_enough_information 48 return s.get(); 49 } 50 x6(Supplier<? extends Supplier<@NullnessUnspecified Object>> s)51 Supplier<@Nullable Object> x6(Supplier<? extends Supplier<@NullnessUnspecified Object>> s) { 52 // jspecify_nullness_not_enough_information 53 return s.get(); 54 } 55 x7(Supplier<? extends Supplier<@Nullable Object>> s)56 Supplier<Object> x7(Supplier<? extends Supplier<@Nullable Object>> s) { 57 // jspecify_nullness_mismatch 58 return s.get(); 59 } 60 x8(Supplier<? extends Supplier<@Nullable Object>> s)61 Supplier<@NullnessUnspecified Object> x8(Supplier<? extends Supplier<@Nullable Object>> s) { 62 // jspecify_nullness_not_enough_information 63 return s.get(); 64 } 65 x9(Supplier<? extends Supplier<@Nullable Object>> s)66 Supplier<@Nullable Object> x9(Supplier<? extends Supplier<@Nullable Object>> s) { 67 return s.get(); 68 } 69 } 70