mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 00:21:26 +00:00
40 lines
901 B
Java
Vendored
40 lines
901 B
Java
Vendored
import org.jspecify.annotations.*;
|
|
|
|
@DefaultNonNull
|
|
public class IgnoreAnnotations {
|
|
@Nullable public Derived field = null;
|
|
|
|
@Nullable
|
|
public Derived foo(Derived x, @NullnessUnspecified Base y) {
|
|
return null;
|
|
}
|
|
|
|
public Derived everythingNotNullable(Derived x) { return null; }
|
|
|
|
public @Nullable Derived everythingNullable(@Nullable Derived x) { return null; }
|
|
|
|
public @NullnessUnspecified Derived everythingUnknown(@NullnessUnspecified Derived x) { return null; }
|
|
}
|
|
|
|
class Base {
|
|
void foo() {}
|
|
}
|
|
|
|
class Derived extends Base { }
|
|
|
|
class Use {
|
|
static void main(IgnoreAnnotations a, Derived x) {
|
|
a.foo(x, null).foo();
|
|
a.foo(null, x).foo();
|
|
|
|
a.field.foo();
|
|
|
|
a.everythingNotNullable(null).foo();
|
|
a.everythingNotNullable(x).foo();
|
|
|
|
a.everythingNullable(null).foo();
|
|
|
|
a.everythingUnknown(null).foo();
|
|
}
|
|
}
|