[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
This commit is contained in:
committed by
TeamCityServer
parent
ef3d966d53
commit
660c438ebe
@@ -0,0 +1,44 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user