660c438ebe
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
45 lines
1.1 KiB
Java
Vendored
45 lines
1.1 KiB
Java
Vendored
import org.jspecify.annotations.*;
|
|
|
|
@DefaultNonNull
|
|
public class Defaults {
|
|
public Foo defaultField = null;
|
|
@Nullable public Foo field = null;
|
|
|
|
public Foo everythingNotNullable(Foo x) { return null; }
|
|
|
|
public @Nullable Foo everythingNullable(@Nullable Foo x) { return null; }
|
|
|
|
public @NullnessUnspecified Foo everythingUnknown(@NullnessUnspecified Foo x) { return null; }
|
|
|
|
public @Nullable Foo mixed(Foo x) { return null; }
|
|
|
|
public Foo explicitlyNullnessUnspecified(@NullnessUnspecified Foo x) { return null; }
|
|
}
|
|
|
|
class Foo {
|
|
public Object foo() { return null; }
|
|
}
|
|
|
|
class Use {
|
|
static void main(Defaults a, Foo x) {
|
|
// jspecify_nullness_mismatch
|
|
a.everythingNotNullable(null).foo();
|
|
a.everythingNotNullable(x).foo();
|
|
|
|
a.everythingNullable(null).foo();
|
|
|
|
a.everythingUnknown(null).foo();
|
|
|
|
// jspecify_nullness_mismatch
|
|
a.mixed(null).foo();
|
|
a.mixed(x).foo();
|
|
|
|
a.explicitlyNullnessUnspecified(x).foo();
|
|
a.explicitlyNullnessUnspecified(null).foo();
|
|
|
|
a.defaultField.foo();
|
|
|
|
a.field.foo();
|
|
}
|
|
}
|