Name Date Size #Lines LOC

..--

annotatedBoundsOfWildcard/annotatedboundsofwildcard/H25-Apr-2025-12669

defaults/defaults/H25-Apr-2025-9550

fullyQualified/fullyqualified/sub/H25-Apr-2025-10116

ignoreAnnotations/ignoreannotations/H25-Apr-2025-8142

implementWithNullableTypeArgument/implementwithnullabletypeargument/H25-Apr-2025-8026

memberSelectNonExpression/memberselectnonexpression/H25-Apr-2025-8753

nonPlatformTypeParameter/nonplatformtypeparameter/H25-Apr-2025-5119

nullnessUnspecifiedTypeParameter/nullnessunspecifiedtypeparameter/H25-Apr-2025-6331

packageDefault/packagedefault/H25-Apr-2025-4710

selfType/selftype/H25-Apr-2025-7834

simple/simple/H25-Apr-2025-5627

typeArgumentsFromParameterBounds/typeargumentsfromparameterbounds/H25-Apr-2025-6734

typeParameterBounds/typeparameterbounds/H25-Apr-2025-6733

wildcardsWithDefault/wildcardswithdefault/H25-Apr-2025-5430

AnnotatedInnerOfNonParameterized.javaH A D25-Apr-20251.9 KiB5523

AnnotatedInnerOfParameterized.javaH A D25-Apr-20251.9 KiB5523

AnnotatedReceiver.javaH A D25-Apr-20251.1 KiB339

AnnotatedTypeParameter.javaH A D25-Apr-20251.1 KiB328

AnnotatedTypeParameterUnspec.javaH A D25-Apr-20251.1 KiB319

AnnotatedWildcard.javaH A D25-Apr-20251.3 KiB4112

AnnotatedWildcardUnspec.javaH A D25-Apr-20251.3 KiB4013

ArraySameType.javaH A D25-Apr-20251.6 KiB5525

ArraySubtype.javaH A D25-Apr-20251.5 KiB5024

AssignmentAsExpression.javaH A D25-Apr-2025903 2912

AugmentedInferenceAgreesWithBaseInference.javaH A D25-Apr-20251.6 KiB4412

BoundedTypeVariableReturn.javaH A D25-Apr-20251.3 KiB5125

CaptureAsInferredTypeArgument.javaH A D25-Apr-20252.2 KiB6935

CaptureConversionForSubtyping.javaH A D25-Apr-2025900 2911

CaptureConvertedToObject.javaH A D25-Apr-20252.3 KiB9255

CaptureConvertedToObjectUnionNull.javaH A D25-Apr-20252.2 KiB8855

CaptureConvertedToObjectUnspec.javaH A D25-Apr-20252.5 KiB9255

CaptureConvertedToOther.javaH A D25-Apr-20252.2 KiB9255

CaptureConvertedToOtherUnionNull.javaH A D25-Apr-20252.2 KiB8855

CaptureConvertedToOtherUnspec.javaH A D25-Apr-20252.5 KiB9255

CaptureConvertedUnionNullToObject.javaH A D25-Apr-20252.7 KiB10256

CaptureConvertedUnionNullToObjectUnionNull.javaH A D25-Apr-20252.4 KiB9056

CaptureConvertedUnionNullToObjectUnspec.javaH A D25-Apr-20253.1 KiB10256

CaptureConvertedUnionNullToOther.javaH A D25-Apr-20252.7 KiB10256

CaptureConvertedUnionNullToOtherUnionNull.javaH A D25-Apr-20252.4 KiB9056

CaptureConvertedUnionNullToOtherUnspec.javaH A D25-Apr-20253.1 KiB10256

CaptureConvertedUnspecToObject.javaH A D25-Apr-20252.8 KiB10256

CaptureConvertedUnspecToObjectUnionNull.javaH A D25-Apr-20252.4 KiB9056

CaptureConvertedUnspecToObjectUnspec.javaH A D25-Apr-20253.1 KiB10256

CaptureConvertedUnspecToOther.javaH A D25-Apr-20252.8 KiB10256

CaptureConvertedUnspecToOtherUnionNull.javaH A D25-Apr-20252.4 KiB9056

CaptureConvertedUnspecToOtherUnspec.javaH A D25-Apr-20253.1 KiB10256

CastOfCaptureOfNotNullMarkedUnboundedWildcardForObjectBoundedTypeParameter.javaH A D25-Apr-20251 KiB4020

CastOfCaptureOfUnboundedWildcardForNotNullMarkedObjectBoundedTypeParameter.javaH A D25-Apr-20251.1 KiB4120

CastOfCaptureOfUnboundedWildcardForObjectBoundedTypeParameter.javaH A D25-Apr-2025914 3212

CastToPrimitive.javaH A D25-Apr-20251 KiB3615

CastWildcardToTypeVariable.javaH A D25-Apr-20251 KiB3817

Catch.javaH A D25-Apr-20251.4 KiB5227

ClassLiteral.javaH A D25-Apr-2025823 3213

ClassToObject.javaH A D25-Apr-20251.6 KiB6233

ClassToSelf.javaH A D25-Apr-20251.5 KiB6434

ComplexParametric.javaH A D25-Apr-20259 KiB274142

ConcatResult.javaH A D25-Apr-20251 KiB3818

ConflictingAnnotations.javaH A D25-Apr-2025954 278

Constants.javaH A D25-Apr-2025971 4826

ContainmentExtends.javaH A D25-Apr-20251.8 KiB5220

ContainmentExtendsBounded.javaH A D25-Apr-20251 KiB3313

ContainmentSuper.javaH A D25-Apr-20251.7 KiB5220

ContainmentSuperVsExtends.javaH A D25-Apr-20251.2 KiB4015

ContainmentSuperVsExtendsSameType.javaH A D25-Apr-2025974 3010

ContravariantReturns.javaH A D25-Apr-20251.2 KiB4317

CovariantReturns.javaH A D25-Apr-20251.4 KiB5024

DereferenceClass.javaH A D25-Apr-20251 KiB4018

DereferenceIntersection.javaH A D25-Apr-20252.4 KiB10467

DereferenceTernary.javaH A D25-Apr-2025888 3011

DereferenceTypeVariable.javaH A D25-Apr-20253 KiB13587

EnumAnnotations.javaH A D25-Apr-2025936 309

ExtendsSameType.javaH A D25-Apr-20251.7 KiB5927

ExtendsTypeVariableImplementedForNullableTypeArgument.javaH A D25-Apr-20251.6 KiB4923

ExtendsVsExtendsNullable.javaH A D25-Apr-20251.7 KiB5426

IfCondition.javaH A D25-Apr-20251.2 KiB4819

InferenceChoosesNullableTypeVariable.javaH A D25-Apr-2025873 279

InstanceOfCheck.javaH A D25-Apr-20251.2 KiB5028

IntersectionSupertype.javaH A D25-Apr-20252.5 KiB9449

LocalVariable.javaH A D25-Apr-20251.3 KiB4924

MultiBoundTypeVariableToObject.javaH A D25-Apr-20251.7 KiB6434

MultiBoundTypeVariableToObjectUnionNull.javaH A D25-Apr-20251.6 KiB6034

MultiBoundTypeVariableToObjectUnspec.javaH A D25-Apr-20251.9 KiB6535

MultiBoundTypeVariableToOther.javaH A D25-Apr-20251.7 KiB6434

MultiBoundTypeVariableToOtherUnionNull.javaH A D25-Apr-20251.6 KiB6034

MultiBoundTypeVariableToOtherUnspec.javaH A D25-Apr-20251.9 KiB6535

MultiBoundTypeVariableToSelf.javaH A D25-Apr-20251.5 KiB6034

MultiBoundTypeVariableToSelfUnionNull.javaH A D25-Apr-20251.6 KiB6034

MultiBoundTypeVariableToSelfUnspec.javaH A D25-Apr-20251.7 KiB6135

MultiBoundTypeVariableUnionNullToObject.javaH A D25-Apr-20251.9 KiB6934

MultiBoundTypeVariableUnionNullToObjectUnionNull.javaH A D25-Apr-20251.7 KiB6135

MultiBoundTypeVariableUnionNullToObjectUnspec.javaH A D25-Apr-20252.3 KiB7237

MultiBoundTypeVariableUnionNullToOther.javaH A D25-Apr-20251.9 KiB6934

MultiBoundTypeVariableUnionNullToOtherUnionNull.javaH A D25-Apr-20251.7 KiB6135

MultiBoundTypeVariableUnionNullToOtherUnspec.javaH A D25-Apr-20252.2 KiB7237

MultiBoundTypeVariableUnionNullToSelf.javaH A D25-Apr-20251.9 KiB6934

MultiBoundTypeVariableUnionNullToSelfUnionNull.javaH A D25-Apr-20251.7 KiB6034

MultiBoundTypeVariableUnionNullToSelfUnspec.javaH A D25-Apr-20252.2 KiB7035

MultiBoundTypeVariableUnspecToObject.javaH A D25-Apr-20252.1 KiB7035

MultiBoundTypeVariableUnspecToObjectUnionNull.javaH A D25-Apr-20251.8 KiB6337

MultiBoundTypeVariableUnspecToObjectUnspec.javaH A D25-Apr-20252.4 KiB7540

MultiBoundTypeVariableUnspecToOther.javaH A D25-Apr-20252.1 KiB7035

MultiBoundTypeVariableUnspecToOtherUnionNull.javaH A D25-Apr-20251.8 KiB6337

MultiBoundTypeVariableUnspecToOtherUnspec.javaH A D25-Apr-20252.3 KiB7540

MultiBoundTypeVariableUnspecToSelf.javaH A D25-Apr-20252.1 KiB7035

MultiBoundTypeVariableUnspecToSelfUnionNull.javaH A D25-Apr-20251.8 KiB6135

MultiBoundTypeVariableUnspecToSelfUnspec.javaH A D25-Apr-20252.3 KiB7439

MultiplePathsToTypeVariable.javaH A D25-Apr-20251.9 KiB7442

NoPathToTypeVariableMinusNull.javaH A D25-Apr-2025988 3515

NonConstantPrimitives.javaH A D25-Apr-2025818 3213

NonNullProjection.javaH A D25-Apr-2025934 3112

NonNullSimple.javaH A D25-Apr-2025817 257

NotNullMarkedAnnotatedInnerOfNonParameterized.javaH A D25-Apr-20252 KiB5321

NotNullMarkedAnnotatedInnerOfParameterized.javaH A D25-Apr-20252 KiB5321

NotNullMarkedAnnotatedTypeParameter.javaH A D25-Apr-20251.1 KiB306

NotNullMarkedAnnotatedTypeParameterUnspec.javaH A D25-Apr-20251 KiB297

NotNullMarkedAnnotatedWildcard.javaH A D25-Apr-20251.3 KiB3910

NotNullMarkedAnnotatedWildcardUnspec.javaH A D25-Apr-20251.3 KiB3811

NotNullMarkedClassToSelf.javaH A D25-Apr-20251.6 KiB6634

NotNullMarkedConcatResult.javaH A D25-Apr-2025996 3616

NotNullMarkedContainmentExtends.javaH A D25-Apr-20251.9 KiB5218

NotNullMarkedContainmentSuper.javaH A D25-Apr-20251.8 KiB5218

NotNullMarkedContainmentSuperVsExtends.javaH A D25-Apr-20251.3 KiB3913

NotNullMarkedIfCondition.javaH A D25-Apr-20251.2 KiB4717

NotNullMarkedInferenceChoosesNullableTypeVariable.javaH A D25-Apr-2025952 3113

NotNullMarkedLocalVariable.javaH A D25-Apr-20251.3 KiB4924

NotNullMarkedOverrides.javaH A D25-Apr-20251.8 KiB6733

NotNullMarkedTypeVariableBound.javaH A D25-Apr-20251.8 KiB7244

NotNullMarkedUnboxing.javaH A D25-Apr-20251.4 KiB6031

NotNullMarkedUseOfTypeVariable.javaH A D25-Apr-20252.2 KiB8747

NotNullMarkedUseOfTypeVariableAsTypeArgument.javaH A D25-Apr-20252.5 KiB9049

NotNullMarkedUseOfWildcardAsTypeArgument.javaH A D25-Apr-20251.3 KiB4925

NullCheck.javaH A D25-Apr-20251.4 KiB5934

NullCheckTypeVariable.javaH A D25-Apr-20251.3 KiB5834

NullCheckTypeVariableUnionNullBound.javaH A D25-Apr-20251.6 KiB7648

NullCheckTypeVariableUnspecBound.javaH A D25-Apr-20251.7 KiB7648

NullLiteralToClass.javaH A D25-Apr-20251,012 3615

NullLiteralToTypeVariable.javaH A D25-Apr-20252.8 KiB12371

NullLiteralToTypeVariableUnionNull.javaH A D25-Apr-20252.5 KiB10771

NullLiteralToTypeVariableUnspec.javaH A D25-Apr-20253.4 KiB12371

NullMarkedDirectUseOfNotNullMarkedBoundedTypeVariable.javaH A D25-Apr-20251.3 KiB5028

NullUnmarkedUndoesNullMarked.javaH A D25-Apr-2025918 2910

NullUnmarkedUndoesNullMarkedForWildcards.javaH A D25-Apr-20251 KiB3414

NullnessDoesNotAffectOverloadSelection.javaH A D25-Apr-2025902 3010

ObjectAsSuperOfTypeVariable.javaH A D25-Apr-20251.1 KiB3817

OutOfBoundsTypeVariable.javaH A D25-Apr-2025979 3615

OverrideParameters.javaH A D25-Apr-20252.3 KiB7835

OverrideParametersThatAreTypeVariables.javaH A D25-Apr-20251.4 KiB5728

OverrideReturns.javaH A D25-Apr-20251.7 KiB6735

ParameterizedWithTypeVariableArgumentToSelf.javaH A D25-Apr-2025814 289

PrimitiveAnnotations.javaH A D25-Apr-20251.2 KiB3915

PrimitiveAnnotationsUnspec.javaH A D25-Apr-20251.2 KiB3715

README.mdH A D25-Apr-20257.4 KiB176126

SameTypeObject.javaH A D25-Apr-20251.8 KiB6734

SameTypeTypeVariable.javaH A D25-Apr-20251.7 KiB6734

SuperNullableForNonNullableTypeParameter.javaH A D25-Apr-20251 KiB3212

SuperObject.javaH A D25-Apr-20251.5 KiB6226

SuperObjectUnionNull.javaH A D25-Apr-20251.3 KiB5826

SuperObjectUnspec.javaH A D25-Apr-20251.5 KiB6226

SuperSameType.javaH A D25-Apr-20251.7 KiB5927

SuperTypeVariable.javaH A D25-Apr-20253.2 KiB14659

SuperTypeVariableUnionNull.javaH A D25-Apr-20252.6 KiB13059

SuperTypeVariableUnspec.javaH A D25-Apr-20253.4 KiB15871

SuperVsObject.javaH A D25-Apr-20251.2 KiB3816

SuperVsSuperNullable.javaH A D25-Apr-20251.7 KiB5426

Ternary.javaH A D25-Apr-20251.9 KiB7637

TypeArgumentOfTypeVariableBound.javaH A D25-Apr-20252 KiB6936

TypeArgumentOfWildcardBound.javaH A D25-Apr-20252.1 KiB7037

TypeVariableMinusNullVsTypeVariable.javaH A D25-Apr-20252.3 KiB5717

TypeVariableToObject.javaH A D25-Apr-20252.8 KiB11971

TypeVariableToObjectUnionNull.javaH A D25-Apr-20252.5 KiB10771

TypeVariableToObjectUnspec.javaH A D25-Apr-20253.3 KiB11971

TypeVariableToParent.javaH A D25-Apr-20252.5 KiB9959

TypeVariableToParentUnionNull.javaH A D25-Apr-20252.3 KiB9159

TypeVariableToParentUnspec.javaH A D25-Apr-20252.8 KiB9959

TypeVariableToSelf.javaH A D25-Apr-20252.5 KiB10771

TypeVariableToSelfUnionNull.javaH A D25-Apr-20252.7 KiB10771

TypeVariableToSelfUnspec.javaH A D25-Apr-20252.9 KiB10771

TypeVariableUnionNullToObject.javaH A D25-Apr-20253.1 KiB12371

TypeVariableUnionNullToObjectUnionNull.javaH A D25-Apr-20252.7 KiB10771

TypeVariableUnionNullToObjectUnspec.javaH A D25-Apr-20253.6 KiB12371

TypeVariableUnionNullToParent.javaH A D25-Apr-20252.7 KiB10359

TypeVariableUnionNullToParentUnionNull.javaH A D25-Apr-20252.5 KiB9159

TypeVariableUnionNullToParentUnspec.javaH A D25-Apr-20253.2 KiB10359

TypeVariableUnionNullToSelf.javaH A D25-Apr-20253.2 KiB12371

TypeVariableUnionNullToSelfUnionNull.javaH A D25-Apr-20252.9 KiB10771

TypeVariableUnionNullToSelfUnspec.javaH A D25-Apr-20253.8 KiB12371

TypeVariableUnspecToObject.javaH A D25-Apr-20253.4 KiB12371

TypeVariableUnspecToObjectUnionNull.javaH A D25-Apr-20252.9 KiB10771

TypeVariableUnspecToObjectUnspec.javaH A D25-Apr-20253.8 KiB12371

TypeVariableUnspecToParent.javaH A D25-Apr-20253 KiB10359

TypeVariableUnspecToParentUnionNull.javaH A D25-Apr-20252.6 KiB9159

TypeVariableUnspecToParentUnspec.javaH A D25-Apr-20253.3 KiB10359

TypeVariableUnspecToSelf.javaH A D25-Apr-20253.6 KiB12371

TypeVariableUnspecToSelfUnionNull.javaH A D25-Apr-20253 KiB10771

TypeVariableUnspecToSelfUnspec.javaH A D25-Apr-20253.9 KiB12371

Unboxing.javaH A D25-Apr-20251.2 KiB5024

UninitializedField.javaH A D25-Apr-20251.1 KiB3812

UnionTypeArgumentWithUseSite.javaH A D25-Apr-20252.5 KiB10457

UnrecognizedLocationsMisc.javaH A D25-Apr-20251.6 KiB5722

UnspecifiedClassTypeArgumentForNonNullableParameter.javaH A D25-Apr-2025965 3111

UnspecifiedTypeArgumentForNonNullableParameter.javaH A D25-Apr-20251.5 KiB4924

UnspecifiedTypeArgumentForNonNullableParameterRepeatedSubstitution.javaH A D25-Apr-20251.7 KiB5326

UnspecifiedTypeArgumentForNonNullableParameterUseUnspec.javaH A D25-Apr-20251.7 KiB5324

UnspecifiedTypeVariableTypeArgumentForNonNullableParameter.javaH A D25-Apr-2025971 3111

UseOfTypeVariableAsTypeArgument.javaH A D25-Apr-20252.2 KiB8345

UseOfTypeVariableUnionNullAsTypeArgument.javaH A D25-Apr-20252.3 KiB8645

UseOfTypeVariableUnspecAsTypeArgument.javaH A D25-Apr-20252.4 KiB8645

WildcardBoundWithAnnotations.javaH A D25-Apr-20251.6 KiB5426

WildcardCapturesToBoundOfTypeParameterNotToTypeVariableItself.javaH A D25-Apr-2025993 2910

README.md

1# Sample inputs
2
3Currently, the main purpose of these samples is to act as a source of test cases
4for authors of nullness checkers that wish to use JSpecify nullness information.
5
6## Disclaimers
7
8These sample inputs are informative, not normative.
9
10They use annotations whose names and meanings are not finalized. Notably, they
11currently use an explicit `@NullnessUnspecified` annotation, even though that
12annotation was not part of our 0.1 milestone and will quite possibly not be part
13of our 1.0 release. (Still, we haven't yet removed the `@NullnessUnspecified`
14usages: First, we're not yet certain whether we'll include that annotation or
15not. Second, the annotation provides an easier way to demonstrate rules that can
16arise without it but are easier to demonstrate with it. We probably wouldn't
17write such samples if we were starting from scratch today, but we wrote them
18when we started, and they appear to provide some value on net.)
19
20They have mostly not been code reviewed.
21
22We do not know if this is even the format that we want our sample inputs to be
23in.
24
25Whatever our final samples look like, we do **not** expect to present them as
26"conformance tests" that require any behavior from tools:
27
28-   JSpecify nullness information may be of use to many kinds of tools, not just
29    "nullness checkers." But these samples are written in a way that makes them
30    most useful to authors of nullness checkers. Authors of other tools -- those
31    that render API descriptions, generate source code, perform refactorings,
32    etc. -- are not best served by the samples' focus on
33    `jspecify_nullness_mismatch`, etc.
34
35-   The goal of JSpecify is to provide one source of nullness information. Tools
36    may use some, all, or none of that information. They may also use
37    information from other sources.
38
39    -   Some examples of "information from other sources":
40
41        -   looking at the *implementation* of a method to decide whether it can
42            return `null`
43        -   looking at non-JSpecify nullness annotations in code
44        -   looking at "overlay" or "stub" information about nullness for
45            well-known APIs
46        -   looking at whether the parameter to a call to `Map.get` is known to
47            be present in that map
48        -   defining a rule to treat all unannotated type usages the same, when
49            the JSpecify rules give some of them "unspecified nullness"
50
51-   Based on the information they have available for any given piece of code,
52    tools always have the option to issue a warning / error / other diagnostic
53    for that code, and they always have the option not to. (Even for a tool that
54    uses *all* JSpecify information and *only* JSpecify information, that
55    information is, at its heart, *information* for tools to apply as their
56    authors see fit.)
57
58## Syntax
59
60<!-- TODO: Update links to point to the markup-format spec and glossary. -->
61
62A special comment on a given line of a `.java` file provides information about
63the following line.
64
65The first three special comments indicate that JSpecify annotations are applied
66in ways that are
67[unrecognized](http://jspecify.org/spec#recognized-locations-type-use). Tools
68are likely to report an error in the case of the first two, somewhat less likely
69to report an error in the case of the third (since they might choose to give
70their meaning to annotations there), and not *obligated* to do anything for any
71of the cases:
72
73-   `jspecify_conflicting_annotations`: for cases like `@Nullable
74    @NullnessUnspecified Foo`
75
76-   `jspecify_nullness_intrinsically_not_nullable`: for cases like `@Nullable
77    int`
78
79-   `jspecify_unrecognized_location`: for the other cases in which JSpecify does
80    not give meaning to an annotation, like `class @Nullable Foo {}`.
81
82The last two comments indicate a nullness violation: an inconsistency between
83two annotations, or between annotations and source code. You can think of these
84as extending the normal JLS type rules to cover types that have been augmented
85with nullness information. (For example, the value of a `return` statement must
86be convertible to the method's return type, and the receiver in a method call
87should not be `@Nullable`.) Nullness checkers are likely to report an error for
88each `jspecify_nullness_mismatch` comment, are likely to make many different
89decisions in whether to issues a diagnostic (error, warning, or no diagnostic)
90for any particular `jspecify_nullness_not_enough_information` comment, and are
91not *obligated* to do anything for any particular comment. (For some background
92on that, see the disclaimers above. Also, note that a nullness checker can be
93sound even if it does not issue errors for some cases of
94`jspecify_nullness_mismatch` or `jspecify_nullness_not_enough_information`!)
95
96-   `jspecify_nullness_mismatch`
97
98-   `jspecify_nullness_not_enough_information`: for nullness violations that
99    involve
100    [unspecified nullness](https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=id.xb9w6p3ilsq3).
101
102TODO: Consider additional features:
103
104-   multiline comments
105-   other locations for comments
106-   multiple findings per line/comment
107-   comments that apply to larger ranges -- possibly to syntax elements (like
108    statements) rather than lines
109-   comments that apply only to a particular part of the line
110
111## Directory structure
112
113See
114[JSpecify: test-data format: Directory structure](https://docs.google.com/document/d/1JVH2p61kReO8bW4AKnbkpybPYlUulVmyNrR1WRIEE_k/edit#bookmark=id.2t1r58i5a03s).
115TODO(#134): Inline that here if Tagir can sign the CLA and contribute it.
116
117Additionally:
118
119Fully qualified class names must be unique across all directories.
120
121> This permits all files to be compiled in a single tool invocation.
122
123TODO: Consider requiring that all individual-file samples be in the top-level
124directory.
125
126Each file must contain a single top-level class. TODO(#133): Consider relaxing
127this.
128
129TODO: Consider requiring a file's path to match its package and class:
130
131-   individual-file samples: `Foo.java` for `Foo`
132
133-   full-directory samples: `sampleFoo/Foo.java` for `Foo`,
134    `sampleFoo/bar/Foo.java` for `bar.Foo`
135
136-   We may need additional accommodations for JPMS support to demonstrate
137    module-level defaulting.
138
139## Restrictions
140
141Files must be UTF-8 encoded.
142
143Files must contain only printable ASCII characters and `\n`.
144
145Files must be compatible with Java 8. TODO(#131): Decide how to label files that
146require a higher version so that we can allow them. (But still encourage
147sticking to Java 8 except for tests that specifically exercise newer features.)
148
149Files must compile without error using stock javac.
150
151Files must not depend on any classes other than the JSpecify annotations. This
152includes the Java platform APIs. Exception: Files may use `java.lang.Object`,
153but they still must not use its methods.
154
155> For example, files may use `Object` as a bound, parameter, or return type.
156
157Files should avoid depending on the presence of absence of "smart" checker
158features, such as:
159
160-   looking inside the body of a method to determine what parameters it
161    dereferences or what it returns
162
163    -   To that end, prefer abstract methods when practical.
164
165-   flow-sensitive typing
166
167We also encourage writing files that demonstrate individual behaviors in
168isolation. For example, we encourage writing files to minimize how much they
169rely on type inference -- except, of course, for any files explicitly intended
170to demonstrate type inference.
171
172## More TODOs
173
174TODO: Consider how to map between samples and related GitHub issues (comments,
175filenames?).
176