Adopt jspecify + NullAway null-checking on fdb-test-utils - #4577
Draft
arnaud-lacurie wants to merge 1 commit into
Draft
Conversation
Wires jspecify + NullAway (via net.ltgt.errorprone) scoped to this module only; both of its unrelated top-level packages (com.apple.foundationdb.test and com.apple.test) are marked @NullMarked and listed in AnnotatedPackages. javax.annotation.Nonnull/Nullable usages replaced with jspecify's @nullable. Compiling with NullAway surfaced a genuine gap: FDBTestEnvironment's clusterFiles list can contain a null entry (meaning "use the default cluster file" when FDB_ENVIRONMENT_YAML is unset), but allClusterFiles(), allClusterFilesInRandomOrder(), and randomClusterFile() were typed as if non-null; now typed List<@nullable String> / @nullable String to match actual behavior. Also hardened parseFDBEnvironmentYaml() to fail fast with a clear IllegalStateException if "clusterFiles" is missing from the yaml, rather than returning null silently.
arnaud-lacurie
commented
Sep 7, 2026
| } | ||
|
|
||
| @Nullable | ||
| public static String randomClusterFile() { |
Collaborator
Author
There was a problem hiding this comment.
Real finding: randomClusterFile() was previously declared to return plain String even though clusterFiles can contain a null entry (the "no fdb-environment.yaml configured" case uses Collections.singletonList(null)), and every other accessor here (getClusterFile(int), and now allClusterFiles()/allClusterFilesInRandomOrder()) already exposed that nullability. So callers of randomClusterFile() (e.g. TestDatabaseExtension.getDatabase()) had no static signal that a null cluster file could come back. Adding @Nullable here, plus widening the backing list to List<@Nullable String>, documents a contract that was previously only true by accident.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
4th of a 14-PR stack adopting jspecify + NullAway null-checking, stacked on #4576 (
fdb-java-annotations). Same treatment applied tofdb-test-utils. See inline comments for specific findings.