replacedTypes;
public static final String CHILD_TYPES = "types";
diff --git a/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy b/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
index cd22f25ce9..ed6d308a4c 100644
--- a/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
+++ b/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
@@ -258,7 +258,6 @@ class JSpecifyAnnotationsCheck extends Specification {
"graphql.schema.GraphQLTypeUtil",
"graphql.schema.GraphQLTypeVisitor",
"graphql.schema.GraphQLTypeVisitorStub",
- "graphql.schema.GraphQLUnionType",
"graphql.schema.GraphQLUnmodifiedType",
"graphql.schema.GraphqlElementParentTree",
"graphql.schema.GraphqlTypeComparatorEnvironment",
From b4761ef4f69a5f30e451185c1127a6ac22611395 Mon Sep 17 00:00:00 2001
From: dondonz <13839920+dondonz@users.noreply.github.com>
Date: Thu, 21 Aug 2025 20:18:36 +1000
Subject: [PATCH 10/16] Tidy up
---
src/main/java/graphql/schema/GraphQLEnumType.java | 2 +-
src/main/java/graphql/schema/GraphQLType.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/graphql/schema/GraphQLEnumType.java b/src/main/java/graphql/schema/GraphQLEnumType.java
index 1700b0b80d..717ad2f99b 100644
--- a/src/main/java/graphql/schema/GraphQLEnumType.java
+++ b/src/main/java/graphql/schema/GraphQLEnumType.java
@@ -135,7 +135,7 @@ public Value> valueToLiteral(Object input, GraphQLContext graphQLContext, Loca
GraphQLEnumValueDefinition enumValueDefinition = valueDefinitionMap.get(input.toString());
if (enumValueDefinition == null) {
assertShouldNeverHappen(i18nMsg(locale, "Enum.badName", name, input.toString()));
- };
+ }
return EnumValue.newEnumValue(enumValueDefinition.getName()).build();
}
diff --git a/src/main/java/graphql/schema/GraphQLType.java b/src/main/java/graphql/schema/GraphQLType.java
index a11099a86b..cb332f2f0c 100644
--- a/src/main/java/graphql/schema/GraphQLType.java
+++ b/src/main/java/graphql/schema/GraphQLType.java
@@ -6,7 +6,7 @@
/**
* A type inside the GraphQLSchema. A type doesn't have to have name, e.g. {@link GraphQLList}.
- *
+ *
* See {@link GraphQLNamedType} for types with a name.
*/
@PublicApi
From 9a78fb3622a8320a13327c3391bdf5737f3730e1 Mon Sep 17 00:00:00 2001
From: dondonz <13839920+dondonz@users.noreply.github.com>
Date: Thu, 21 Aug 2025 20:27:19 +1000
Subject: [PATCH 11/16] Annotate GraphQLScalarType
---
.../graphql/schema/GraphQLScalarType.java | 22 ++++++++++---------
.../archunit/JSpecifyAnnotationsCheck.groovy | 1 -
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/main/java/graphql/schema/GraphQLScalarType.java b/src/main/java/graphql/schema/GraphQLScalarType.java
index bf5442cda9..2c091e3f36 100644
--- a/src/main/java/graphql/schema/GraphQLScalarType.java
+++ b/src/main/java/graphql/schema/GraphQLScalarType.java
@@ -14,7 +14,10 @@
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
+
+import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullUnmarked;
+import org.jspecify.annotations.Nullable;
import static graphql.Assert.assertNotNull;
import static graphql.Assert.assertValidName;
@@ -29,7 +32,7 @@
* for example, a GraphQL system could define a scalar called Time which, while serialized as a string, promises to
* conform to ISO‐8601. When querying a field of type Time, you can then rely on the ability to parse the result with an ISO‐8601 parser and use a client‐specific primitive for time.
*
- * From the spec : https://spec.graphql.org/October2021/#sec-Scalars
+ * From the spec : ...
*
*
* graphql-java ships with a set of predefined scalar types via {@link graphql.Scalars}
@@ -37,26 +40,26 @@
* @see graphql.Scalars
*/
@PublicApi
-public class
-GraphQLScalarType implements GraphQLNamedInputType, GraphQLNamedOutputType, GraphQLUnmodifiedType, GraphQLNullableType, GraphQLDirectiveContainer {
+@NullMarked
+public class GraphQLScalarType implements GraphQLNamedInputType, GraphQLNamedOutputType, GraphQLUnmodifiedType, GraphQLNullableType, GraphQLDirectiveContainer {
private final String name;
- private final String description;
+ private final @Nullable String description;
private final Coercing, ?> coercing;
private final ScalarTypeDefinition definition;
private final ImmutableList extensionDefinitions;
private final DirectivesUtil.DirectivesHolder directivesHolder;
- private final String specifiedByUrl;
+ private final @Nullable String specifiedByUrl;
@Internal
private GraphQLScalarType(String name,
- String description,
+ @Nullable String description,
Coercing, ?> coercing,
List directives,
List appliedDirectives,
ScalarTypeDefinition definition,
List extensionDefinitions,
- String specifiedByUrl) {
+ @Nullable String specifiedByUrl) {
assertValidName(name);
assertNotNull(coercing, () -> "coercing can't be null");
assertNotNull(directives, () -> "directives can't be null");
@@ -76,11 +79,11 @@ public String getName() {
}
- public String getDescription() {
+ public @Nullable String getDescription() {
return description;
}
- public String getSpecifiedByUrl() {
+ public @Nullable String getSpecifiedByUrl() {
return specifiedByUrl;
}
@@ -213,7 +216,6 @@ public static Builder newScalar(GraphQLScalarType existing) {
return new Builder(existing);
}
-
@PublicApi
@NullUnmarked
public static class Builder extends GraphqlDirectivesContainerTypeBuilder {
diff --git a/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy b/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
index ed6d308a4c..f602807076 100644
--- a/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
+++ b/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
@@ -252,7 +252,6 @@ class JSpecifyAnnotationsCheck extends Specification {
"graphql.schema.GraphQLNullableType",
"graphql.schema.GraphQLObjectType",
"graphql.schema.GraphQLOutputType",
- "graphql.schema.GraphQLScalarType",
"graphql.schema.GraphQLSchemaElement",
"graphql.schema.GraphQLTypeReference",
"graphql.schema.GraphQLTypeUtil",
From 7bbfd9c62f2ae3fcfa5b6495906c2015c969a9f2 Mon Sep 17 00:00:00 2001
From: dondonz <13839920+dondonz@users.noreply.github.com>
Date: Thu, 21 Aug 2025 20:28:50 +1000
Subject: [PATCH 12/16] Annotate GraphQLNamedInputType
---
src/main/java/graphql/schema/GraphQLNamedInputType.java | 2 ++
.../groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy | 1 -
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/graphql/schema/GraphQLNamedInputType.java b/src/main/java/graphql/schema/GraphQLNamedInputType.java
index d44aeb7bab..493242b7bc 100644
--- a/src/main/java/graphql/schema/GraphQLNamedInputType.java
+++ b/src/main/java/graphql/schema/GraphQLNamedInputType.java
@@ -2,11 +2,13 @@
import graphql.PublicApi;
+import org.jspecify.annotations.NullMarked;
/**
* Input types represent those set of types that are allowed to be accepted as graphql mutation input, as opposed
* to {@link GraphQLOutputType}s which can only be used as graphql response output.
*/
@PublicApi
+@NullMarked
public interface GraphQLNamedInputType extends GraphQLInputType, GraphQLNamedType {
}
diff --git a/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy b/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
index f602807076..7e684a58a8 100644
--- a/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
+++ b/src/test/groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy
@@ -244,7 +244,6 @@ class JSpecifyAnnotationsCheck extends Specification {
"graphql.schema.GraphQLInputValueDefinition",
"graphql.schema.GraphQLInterfaceType",
"graphql.schema.GraphQLModifiedType",
- "graphql.schema.GraphQLNamedInputType",
"graphql.schema.GraphQLNamedOutputType",
"graphql.schema.GraphQLNamedSchemaElement",
"graphql.schema.GraphQLNamedType",
From 7427f644997554179cb3b675932b7be57fdb6e32 Mon Sep 17 00:00:00 2001
From: dondonz <13839920+dondonz@users.noreply.github.com>
Date: Sat, 23 Aug 2025 16:10:17 +0200
Subject: [PATCH 13/16] Add ErrorType
---
src/main/java/graphql/ErrorType.java | 3 +++
src/main/java/graphql/GraphQLError.java | 6 +++---
.../groovy/graphql/archunit/JSpecifyAnnotationsCheck.groovy | 3 +--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/main/java/graphql/ErrorType.java b/src/main/java/graphql/ErrorType.java
index 9adee6d461..0e8d85cfcf 100644
--- a/src/main/java/graphql/ErrorType.java
+++ b/src/main/java/graphql/ErrorType.java
@@ -1,10 +1,13 @@
package graphql;
+import org.jspecify.annotations.NullMarked;
+
/**
* All the errors in graphql belong to one of these categories
*/
@PublicApi
+@NullMarked
public enum ErrorType implements ErrorClassification {
InvalidSyntax,
ValidationError,
diff --git a/src/main/java/graphql/GraphQLError.java b/src/main/java/graphql/GraphQLError.java
index 90c3527b50..5f4e0412d0 100644
--- a/src/main/java/graphql/GraphQLError.java
+++ b/src/main/java/graphql/GraphQLError.java
@@ -11,7 +11,7 @@
/**
* The interface describing graphql errors
- *
+ *
* NOTE: This class implements {@link java.io.Serializable} and hence it can be serialised and placed into a distributed cache. However we
* are not aiming to provide long term compatibility and do not intend for you to place this serialised data into permanent storage,
* with times frames that cross graphql-java versions. While we don't change things unnecessarily, we may inadvertently break
@@ -42,7 +42,7 @@ public interface GraphQLError extends Serializable {
* The graphql spec says that the (optional) path field of any error must be
* a list of path entries starting at the root of the response
* and ending with the field associated with the error
- * https://spec.graphql.org/draft/#sec-Errors.Error-Result-Format
+ * ...
*
* @return the path in list format
*/
@@ -54,7 +54,7 @@ default List