Skip to content

Commit 0504013

Browse files
committed
using immutable list in FetchedValue
1 parent d1a4c15 commit 0504013

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/main/java/graphql/execution/FetchedValue.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import graphql.GraphQLError;
55
import graphql.Internal;
66

7-
import java.util.ArrayList;
87
import java.util.List;
98
import java.util.function.Consumer;
109

@@ -13,12 +12,12 @@ public class FetchedValue {
1312
private final Object fetchedValue;
1413
private final Object rawFetchedValue;
1514
private final Object localContext;
16-
private final ImmutableList<GraphQLError> errors;
15+
private final List<GraphQLError> errors;
1716

1817
private FetchedValue(Object fetchedValue, Object rawFetchedValue, List<GraphQLError> errors, Object localContext) {
1918
this.fetchedValue = fetchedValue;
2019
this.rawFetchedValue = rawFetchedValue;
21-
this.errors = ImmutableList.copyOf(errors);
20+
this.errors = errors;
2221
this.localContext = localContext;
2322
}
2423

@@ -75,7 +74,7 @@ public static class Builder {
7574
private Object fetchedValue;
7675
private Object rawFetchedValue;
7776
private Object localContext;
78-
private List<GraphQLError> errors = new ArrayList<>();
77+
private List<GraphQLError> errors = ImmutableList.of();
7978

8079
public Builder fetchedValue(Object fetchedValue) {
8180
this.fetchedValue = fetchedValue;
@@ -93,7 +92,7 @@ public Builder localContext(Object localContext) {
9392
}
9493

9594
public Builder errors(List<GraphQLError> errors) {
96-
this.errors = errors;
95+
this.errors = ImmutableList.copyOf(errors);
9796
return this;
9897
}
9998

0 commit comments

Comments
 (0)