Debian Codegraph @

samples/OverrideParametersThatAreTypeVariables.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
19 @NullMarked
20 class OverrideParametersThatAreTypeVariables {
21 interface Super<E extends @Nullable Object> {
22 void useE(E e);
23
24 <F extends E> void useF(F f);
25
26 void useLibE(Lib<E> e);
27
28 <F extends E> void useLibF(Lib<F> f);
29
30 void useArrayOfE(E[] e);
31
32 <F extends E> void useArrayOfF(F[] f);
33 }
34
35 interface Sub<T extends @Nullable Object> extends Super<T> {
36 @Override
37 void useE(T e);
38
39 @Override
40 <U extends T> void useF(U f);
41
42 @Override
43 void useLibE(Lib<T> e);
44
45 @Override
46 <U extends T> void useLibF(Lib<U> f);
47
48 @Override
49 void useArrayOfE(T[] e);
50
51 @Override
52 <U extends T> void useArrayOfF(U[] f);
53 }
54
55 interface Lib<T extends @Nullable Object> {}
56 }