Skip to content

Commit dda29af

Browse files
andimarekclaude
authored andcommitted
Fix NullAway 0.13.1 compatibility issues
- ArrayValue/ObjectValue: inline assertNotNull(deepCopy(...)) to avoid @nullable local variable being passed where @nonnull is required - MergedField: replace assertNotNull on @nullable Builder field with explicit null check to satisfy stricter NullAway type inference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1d5bb11 commit dda29af

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/main/java/graphql/execution/MergedField.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import java.util.function.Consumer;
1717

1818
import static graphql.Assert.assertNotEmpty;
19-
import static graphql.Assert.assertNotNull;
19+
2020

2121
/**
2222
* This represents all Fields in a query which overlap and are merged into one.
@@ -428,7 +428,11 @@ public MergedField build() {
428428
if (this.singleField != null && this.fields == null) {
429429
return new MergedField(singleField, deferredExecutions);
430430
}
431-
ImmutableList<Field> fields = assertNotNull(this.fields, "You MUST add at least one field via the builder").build();
431+
ImmutableList.Builder<Field> fieldsBuilder = this.fields;
432+
if (fieldsBuilder == null) {
433+
throw new AssertionError("You MUST add at least one field via the builder");
434+
}
435+
ImmutableList<Field> fields = fieldsBuilder.build();
432436
assertNotEmpty(fields);
433437
return new MultiMergedField(fields, deferredExecutions);
434438
}

src/main/java/graphql/language/ArrayValue.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ public String toString() {
9191

9292
@Override
9393
public ArrayValue deepCopy() {
94-
List<Value> copiedValues = assertNotNull(deepCopy(values));
95-
return new ArrayValue(copiedValues, getSourceLocation(), getComments(), getIgnoredChars(), getAdditionalData());
94+
return new ArrayValue(assertNotNull(deepCopy(values)), getSourceLocation(), getComments(), getIgnoredChars(), getAdditionalData());
9695
}
9796

9897
@Override

src/main/java/graphql/language/ObjectValue.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public boolean isEqualTo(@Nullable Node o) {
8181

8282
@Override
8383
public ObjectValue deepCopy() {
84-
List<ObjectField> copiedFields = assertNotNull(deepCopy(objectFields));
85-
return new ObjectValue(copiedFields, getSourceLocation(), getComments(), getIgnoredChars(), getAdditionalData());
84+
return new ObjectValue(assertNotNull(deepCopy(objectFields)), getSourceLocation(), getComments(), getIgnoredChars(), getAdditionalData());
8685
}
8786

8887

0 commit comments

Comments
 (0)