Files
kotlin-fork/compiler/testData/foreignAnnotations/java8Tests/jspecify/java/Simple.java
T
Dmitriy Novozhilov 660c438ebe [Test] Migrate tests of foreign annotations to new infrastructure
This commit includes:
- test runners for foreign annotation tests
- minor changes testdata related to changed directives syntax
- dropping tests with javac integration: old javac tests actually ran
    compiler without javac because of bug in configuration, so some
    nullability annotations features are not supported in javac mode.
    It's fine to drop it since javac mode is not fully supported
    by compiler
2020-12-24 14:58:05 +03:00

34 lines
579 B
Java
Vendored

import org.jspecify.annotations.*;
@DefaultNonNull
public class Simple {
@Nullable public Derived field = null;
@Nullable
public Derived foo(Derived x, @NullnessUnspecified Base y) {
return null;
}
public Derived bar() {
return null;
}
}
class Base {}
class Derived extends Base {
void foo() {}
}
@DefaultNonNull
class Use {
static public void main(Simple a, Derived x) {
a.foo(x, null).foo();
// jspecify_nullness_mismatch
a.foo(null, x).foo();
a.bar().foo();
a.field.foo();
}
}