Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

Annotates 10 classes in graphql.execution package following established JSpecify patterns to enable nullability static analysis.

Annotated Classes

  • AbortExecutionException, AsyncExecutionStrategy, AsyncSerialExecutionStrategy, CoercedVariables, DataFetcherExceptionHandlerParameters, DataFetcherExceptionHandlerResult, DefaultValueUnboxer, ExecutionContext, ExecutionId, ExecutionStepInfo

Pattern Applied

  • Class level: @NullMarked
  • Builder static classes: @NullUnmarked (no further annotations needed)
  • Nullable returns/fields: @Nullable where methods can return null or fields can be null

Notable Changes

Nullable returns identified:

  • AbortExecutionException.getLocations() - returns null per GraphQLError interface
  • CoercedVariables.get() - returns null for missing keys
  • ExecutionStepInfo.getParent() - null for root query types
  • ExecutionStepInfo.getArgument() - null for missing arguments
  • ExecutionContext.getFragment() - null for missing fragments

NullAway compliance:

  • Added assertNotNull() wrapping AtomicReference.get() in ExecutionContext (initialized non-null, always set to non-null)
  • Added assertNotNull() on ExecutionStepInfo.getParent() call in UnresolvedTypeError (parent always present for field resolution errors)
  • Suppressed NullAway on DefaultValueUnboxer.unbox() - interface not yet annotated but implementation correctly returns null for empty Optional

Removed all 10 classes from exemption list in JSpecifyAnnotationsCheck.

Original prompt

Task

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

Classes to annotate

  1. graphql.execution.AbortExecutionException
  2. graphql.execution.AsyncExecutionStrategy
  3. graphql.execution.AsyncSerialExecutionStrategy
  4. graphql.execution.CoercedVariables
  5. graphql.execution.DataFetcherExceptionHandlerParameters
  6. graphql.execution.DataFetcherExceptionHandlerResult
  7. graphql.execution.DefaultValueUnboxer
  8. graphql.execution.ExecutionContext
  9. graphql.execution.ExecutionId
  10. graphql.execution.ExecutionStepInfo

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.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add JSpecify annotations to execution classes Add JSpecify annotations to 10 classes in graphql.execution Jan 25, 2026
Copilot AI requested a review from dondonz January 25, 2026 07:11
@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