JSpecify big wave 3#4274
Conversation
| * This Exception indicates that the current execution should be aborted. | ||
| */ | ||
| @PublicApi | ||
| @NullMarked |
There was a problem hiding this comment.
I abruptly ran out of credits here - more is coming
There was a problem hiding this comment.
Given it's already 66 classes - the next wave will happen in a separate PR
Test Results 335 files ±0 335 suites ±0 5m 4s ⏱️ -2s Results for commit 0a77532. ± Comparison against base commit 739403f. This pull request removes 196 and adds 172 tests. Note that renamed tests count towards both.This pull request skips 1 test.♻️ This comment has been updated with latest results. |
All 66 classes annotated in Wave 1 (graphql.analysis, graphql.execution core, and graphql.execution sub-packages) are removed from the exemption list now that they carry @NullMarked. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
| graphql.execution.reactive.DelegatingSubscription | ||
| graphql.execution.reactive.SubscriptionPublisher | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Worker 4 got removed because it was covered by previous PRs.
Work from worker 5 onwards will be in another PR. This PR is already quite large
- Explicitly state that @internal classes must not be annotated - Tighten exemption list cleanup instruction to remove only the annotated class Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
| * @return this builder | ||
| */ | ||
| public Builder valueLiteral(@NonNull Value<?> value) { | ||
| public Builder valueLiteral(Value<?> value) { |
There was a problem hiding this comment.
So you tuned OFF null marked but this is no less precise than it was. Perhaps a Object.requireNonNull ??
|
|
||
| @Nullable | ||
| public List<? extends GraphQLError> getErrors() { | ||
| return errors; |
There was a problem hiding this comment.
Maybe we should change this so that errors is always non null but some times empty?
Document has to nullable of course. Quasi breaking change but nicer - eg less nullable things
There was a problem hiding this comment.
That's a good idea, you mentioned this in another class too. I think better to make it an empty list by default, like DataFetcherResult
There was a problem hiding this comment.
I will add a breaking change label
|
I'm impressed, I have the correct number of fingers on both hands. Models have come a long way. But I'm going to deduct marks for Python references creeping in! |
Test ReportTest Results
Code Coverage (Java 25)
Changed Class Coverage (1 class)
|
# Conflicts: # .claude/commands/jspecify-annotate.md # src/main/java/graphql/execution/ExecutionContext.java # src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
…tated classes from exemption list - Update PreparsedDocumentEntryTest to expect empty list instead of null for errors - Remove 10 classes from JSpecify exemption list that are already annotated Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
….parseAndValidate Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
| @Override | ||
| public List<SourceLocation> getLocations() { | ||
| public @Nullable List<SourceLocation> getLocations() { | ||
| return null; |
There was a problem hiding this comment.
TODO open question if we want null or an empty list here?
There was a problem hiding this comment.
as a general rule we always do empty list instead of null list
| @Override | ||
| public List<SourceLocation> getLocations() { | ||
| public @Nullable List<SourceLocation> getLocations() { | ||
| return sourceLocations; |
There was a problem hiding this comment.
Also a TODO question - should we have any lists returning null?
There was a problem hiding this comment.
same as above ... in general we always to return empty lists instead of null
|
|
||
| @Override | ||
| public List<SourceLocation> getLocations() { | ||
| public @Nullable List<SourceLocation> getLocations() { |
There was a problem hiding this comment.
TODO Should any list (not only errors) be nullable?
andimarek
left a comment
There was a problem hiding this comment.
There are some comments about empty list vs null ... I actually think we should create a todo and fix that up later ... lets focus on nullable stuff for now.
Looks good.
| @Override | ||
| public List<SourceLocation> getLocations() { | ||
| public @Nullable List<SourceLocation> getLocations() { | ||
| return null; |
There was a problem hiding this comment.
as a general rule we always do empty list instead of null list
| @Override | ||
| public List<SourceLocation> getLocations() { | ||
| public @Nullable List<SourceLocation> getLocations() { | ||
| return sourceLocations; |
There was a problem hiding this comment.
same as above ... in general we always to return empty lists instead of null
|
|
||
| @Override | ||
| public List<SourceLocation> getLocations() { | ||
| public @Nullable List<SourceLocation> getLocations() { |
| @Override | ||
| public List<Object> getPath() { | ||
| public @Nullable List<Object> getPath() { | ||
| return path; |
There was a problem hiding this comment.
same hear ... about not return null for lists.


Another wave of JSpecify changes, this time featuring Claude's agent teams.
66 classes annotated
graphql.analysis (16 classes)
QueryComplexityCalculator,QueryComplexityInfo,QueryDepthInfo,QueryReducer,QueryTransformer,QueryTraversalOptions,QueryVisitor,QueryVisitorFieldArgumentEnvironment,QueryVisitorFieldArgumentInputValue,QueryVisitorFieldArgumentValueEnvironment,QueryVisitorFieldEnvironment,QueryVisitorFragmentDefinitionEnvironment,QueryVisitorFragmentSpreadEnvironment,QueryVisitorInlineFragmentEnvironment,QueryVisitorStub,ValueTraversergraphql.execution core (26 classes)
AbortExecutionException,AsyncExecutionStrategy,AsyncSerialExecutionStrategy,CoercedVariables,DataFetcherExceptionHandlerParameters,DataFetcherExceptionHandlerResult,DefaultValueUnboxer,ExecutionContext,ExecutionId,ExecutionStepInfo,ExecutionStrategyParameters,FetchedValue,FieldValueInfo,InputMapDefinesTooManyFieldsException,MergedSelectionSet,MissingRootTypeException,NonNullableValueCoercedAsNullException,NormalizedVariables,OneOfNullValueException,OneOfTooManyKeysException,ResultNodesInfo,ResultPath,SimpleDataFetcherExceptionHandler,SubscriptionExecutionStrategy,UnknownOperationException,UnresolvedTypeExceptiongraphql.execution sub-packages (24 classes)
ConditionalNodeDecision,QueryAppliedDirective,QueryAppliedDirectiveArgument,QueryDirectives,FieldValidationInstrumentation,SimpleFieldValidation,InstrumentationCreateStateParameters,InstrumentationExecuteOperationParameters,InstrumentationExecutionParameters,InstrumentationExecutionStrategyParameters,InstrumentationFieldCompleteParameters,InstrumentationFieldFetchParameters,InstrumentationFieldParameters,InstrumentationValidationParameters,TracingInstrumentation,TracingSupport,PreparsedDocumentEntry,ApolloPersistedQuerySupport,InMemoryPersistedQueryCache,PersistedQueryCacheMiss,PersistedQueryIdInvalid,PersistedQueryNotFound,DelegatingSubscription,SubscriptionPublisherReview passes
./gradlew compileJavapasses. The reviewer agent also fixed cascading NullAway errors in calling code (e.g.ResultPath,ExecutionStepInfo,ExecutionContext,TracingSupport) usingassertNotNull()where structural invariants guarantee non-null.