Debian Codegraph @

samples/typeArgumentsFromParameterBounds/typeargumentsfromparameterbounds/TypeArgumentsFromParameterBounds.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 package typeargumentsfromparameterbounds;
17
18 import org.jspecify.annotations.NullMarked;
19 import org.jspecify.annotations.Nullable;
20 import org.jspecify.annotations.NullnessUnspecified;
21
22 @NullMarked
23 public class TypeArgumentsFromParameterBounds<
24 T extends Object, E extends @Nullable Object, F extends @NullnessUnspecified Object> {}
25
26 @NullMarked
27 class A {
28 public void bar(TypeArgumentsFromParameterBounds<Test, Test, Test> a) {}
29 }
30
31 class B {
32 // jspecify_nullness_not_enough_information
33 public void bar(TypeArgumentsFromParameterBounds<Test, Test, Test> a) {}
34 }
35
36 class Test {}
37
38 @NullMarked
39 class Use {
40 public static void main(
41 TypeArgumentsFromParameterBounds<Test, Test, Test> aNotNullNotNullNotNull,
42 // jspecify_nullness_not_enough_information
43 TypeArgumentsFromParameterBounds<Test, Test, @Nullable Test> aNotNullNotNullNull,
44 TypeArgumentsFromParameterBounds<Test, @Nullable Test, Test> aNotNullNullNotNull,
45 // jspecify_nullness_not_enough_information
46 TypeArgumentsFromParameterBounds<Test, @Nullable Test, @Nullable Test> aNotNullNullNull,
47 A a,
48 B b) {
49 a.bar(aNotNullNotNullNotNull);
50 // jspecify_nullness_mismatch
51 a.bar(aNotNullNotNullNull);
52 // jspecify_nullness_mismatch
53 a.bar(aNotNullNullNotNull);
54 // jspecify_nullness_mismatch
55 a.bar(aNotNullNullNull);
56
57 // jspecify_nullness_not_enough_information
58 b.bar(aNotNullNotNullNotNull);
59 // jspecify_nullness_not_enough_information
60 b.bar(aNotNullNotNullNull);
61 // jspecify_nullness_not_enough_information
62 b.bar(aNotNullNullNotNull);
63 // jspecify_nullness_not_enough_information
64 b.bar(aNotNullNullNull);
65 }
66 }