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 interface IntersectionSupertype { x0(T t)22 <T extends Object & Lib> void x0(T t); 23 x1(T t)24 <T extends @NullnessUnspecified Object & Lib> void x1(T t); 25 x2(T t)26 <T extends @Nullable Object & Lib> void x2(T t); 27 x3(T t)28 <T extends Object & @NullnessUnspecified Lib> void x3(T t); 29 x4(T t)30 <T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> void x4(T t); 31 x5(T t)32 <T extends @Nullable Object & @NullnessUnspecified Lib> void x5(T t); 33 x6(T t)34 <T extends Object & @Nullable Lib> void x6(T t); 35 x7(T t)36 <T extends @NullnessUnspecified Object & @Nullable Lib> void x7(T t); 37 x8(T t)38 <T extends @Nullable Object & @Nullable Lib> void x8(T t); 39 useLib(Lib lib)40 default void useLib(Lib lib) { 41 x0(lib); 42 x1(lib); 43 x2(lib); 44 x3(lib); 45 x4(lib); 46 x5(lib); 47 x6(lib); 48 x7(lib); 49 x8(lib); 50 } 51 useLibUnspec(@ullnessUnspecified Lib lib)52 default void useLibUnspec(@NullnessUnspecified Lib lib) { 53 // jspecify_nullness_not_enough_information 54 x0(lib); 55 // jspecify_nullness_not_enough_information 56 x1(lib); 57 // jspecify_nullness_not_enough_information 58 x2(lib); 59 // jspecify_nullness_not_enough_information 60 x3(lib); 61 // jspecify_nullness_not_enough_information 62 x4(lib); 63 // jspecify_nullness_not_enough_information 64 x5(lib); 65 // jspecify_nullness_not_enough_information 66 x6(lib); 67 // jspecify_nullness_not_enough_information 68 x7(lib); 69 this.<@Nullable Lib>x8(lib); 70 } 71 useLibUnionNull(@ullable Lib lib)72 default void useLibUnionNull(@Nullable Lib lib) { 73 // jspecify_nullness_mismatch 74 x0(lib); 75 // jspecify_nullness_mismatch 76 x1(lib); 77 // jspecify_nullness_mismatch 78 x2(lib); 79 // jspecify_nullness_mismatch 80 x3(lib); 81 // jspecify_nullness_not_enough_information 82 x4(lib); 83 // jspecify_nullness_not_enough_information 84 x5(lib); 85 // jspecify_nullness_mismatch 86 x6(lib); 87 // jspecify_nullness_not_enough_information 88 x7(lib); 89 x8(lib); 90 } 91 92 interface Lib {} 93 } 94