Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

Annotates 10 classes in graphql.execution package with JSpecify nullability markers, following the established pattern in the codebase.

Annotated Classes

  • ResultNodesInfo
  • ResultPath - nullable parent/segment fields, nullable returns for getParent() and dropSegment()
  • SimpleDataFetcherExceptionHandler
  • SubscriptionExecutionStrategy - nullable return for mkReactivePublisher()
  • UnknownOperationException - nullable return for getLocations()
  • UnresolvedTypeException
  • conditional.ConditionalNodeDecision
  • directives.QueryAppliedDirective - nullable definition field
  • directives.QueryAppliedDirectiveArgument - nullable definition field, nullable generic return for getValue()
  • directives.QueryDirectives

Implementation

  • Applied @NullMarked at class/interface level
  • Marked Builder inner classes with @NullUnmarked
  • Added @Nullable annotations to nullable fields and return types
  • Removed redundant @NonNull annotations (now implicit under @NullMarked)
  • Added assertNotNull guards in ResultPath and SubscriptionExecutionStrategy for NullAway compliance
  • Removed classes from exemption list in JSpecifyAnnotationsCheck.groovy

Example

@PublicApi
@NullMarked
public class ResultPath {
    private final @Nullable ResultPath parent;
    private final @Nullable Object segment;
    
    public @Nullable ResultPath dropSegment() {
        if (this == rootPath()) {
            return null;
        }
        return this.parent;
    }
    
    @NullUnmarked
    public static class Builder {
        // Builder doesn't require null annotations
    }
}
Original prompt

Task

Add JSpecify annotations to the following 10 classes in the graphql.execution package and subpackages, following the established JSpecify annotation pattern documented in .claude/commands/jspecify-annotate.md.

Classes to annotate

  1. graphql.execution.ResultNodesInfo
  2. graphql.execution.ResultPath
  3. graphql.execution.SimpleDataFetcherExceptionHandler
  4. graphql.execution.SubscriptionExecutionStrategy
  5. graphql.execution.UnknownOperationException
  6. graphql.execution.UnresolvedTypeException
  7. graphql.execution.conditional.ConditionalNodeDecision
  8. graphql.execution.directives.QueryAppliedDirective
  9. graphql.execution.directives.QueryAppliedDirectiveArgument
  10. graphql.execution.directives.QueryDirectives

Instructions

Follow the JSpecify annotation process documented in .claude/commands/jspecify-annotate.md:

  1. Set each class to be @NullMarked at the class level
  2. Remove all redundant @NonNull annotations that IntelliJ may have added
  3. Check Javadoc for @param tags mentioning "null", "nullable", "may be null"
  4. Check Javadoc @return tags mentioning "null", "optional", "if available"
  5. Inspect method implementations that return null or check for null
  6. Consider GraphQL specification details when determining nullability
  7. For Builder static classes, label them @NullUnmarked and no further annotations needed

Validation

After making changes, run the NullAway compile check:

./gradlew compileJava

If you find NullAway errors, make the smallest possible change to fix them. You can use assertNotNull with a message if needed.

Cleanup

  1. Remove each completed class from the exemption list in src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
  2. Delete all unused imports from the classes you've annotated
  3. Do not make spacing or formatting changes - only make minimal changes necessary for the annotations

Reference

Look at existing annotated classes in the repository for reference patterns.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add JSpecify annotations to classes in graphql.execution Add JSpecify annotations to 10 classes in graphql.execution package Jan 25, 2026
Copilot AI requested a review from dondonz January 25, 2026 07:39
return this;
}
return parent;
return assertNotNull(parent, "parent should not be null for non-root path");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: check this


public String getSegmentName() {
return (String) segment;
return (String) assertNotNull(segment, "segment should not be null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: check if we want these asserts here

}

return self.isRootPath() && that.isRootPath();
return (self == null || self.isRootPath()) && (that == null || that.isRootPath());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: double check this change in return statement

@dondonz dondonz changed the base branch from copilot/add-jspecify-annotations-to-classes to master February 8, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants