Skip to content

Commit 36b5d7c

Browse files
author
Jiayu Liu
committed
fix with diamond operator
1 parent 3abfdd7 commit 36b5d7c

File tree

82 files changed

+198
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+198
-198
lines changed

src/main/java/graphql/ExecutionResultImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class ExecutionResultImpl implements ExecutionResult {
1010

11-
private final List<GraphQLError> errors = new ArrayList<GraphQLError>();
11+
private final List<GraphQLError> errors = new ArrayList<>();
1212
private Object data;
1313
private Map<Object,Object> extensions = null;
1414

@@ -28,7 +28,7 @@ public ExecutionResultImpl(Object data, List<? extends GraphQLError> errors, Map
2828
}
2929

3030
if (extensions != null && !extensions.isEmpty()) {
31-
this.extensions = new HashMap<Object,Object>(extensions);
31+
this.extensions = new HashMap<>(extensions);
3232
}
3333
}
3434

@@ -53,11 +53,11 @@ public void setData(Object result) {
5353

5454
@Override
5555
public List<GraphQLError> getErrors() {
56-
return new ArrayList<GraphQLError>(errors);
56+
return new ArrayList<>(errors);
5757
}
5858

5959
@Override
6060
public Map<Object, Object> getExtensions() {
61-
return extensions == null ? null : new HashMap<Object,Object>(extensions);
61+
return extensions == null ? null : new HashMap<>(extensions);
6262
}
6363
}

src/main/java/graphql/InvalidSyntaxError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class InvalidSyntaxError implements GraphQLError {
1010

11-
private final List<SourceLocation> sourceLocations = new ArrayList<SourceLocation>();
11+
private final List<SourceLocation> sourceLocations = new ArrayList<>();
1212

1313
public InvalidSyntaxError(SourceLocation sourceLocation) {
1414
if (sourceLocation != null)

src/main/java/graphql/execution/Execution.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ private ExecutionResult executeOperation(
7575
return new ExecutionResultImpl(Collections.singletonList(new MutationNotSupportedError()));
7676
}
7777

78-
Map<String, List<Field>> fields = new LinkedHashMap<String, List<Field>>();
79-
fieldCollector.collectFields(executionContext, operationRootType, operationDefinition.getSelectionSet(), new ArrayList<String>(), fields);
78+
Map<String, List<Field>> fields = new LinkedHashMap<>();
79+
fieldCollector.collectFields(executionContext, operationRootType, operationDefinition.getSelectionSet(), new ArrayList<>(), fields);
8080

8181
ExecutionResult result;
8282
if (operation == MUTATION) {

src/main/java/graphql/execution/ExecutionContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class ExecutionContext {
2222
private final OperationDefinition operationDefinition;
2323
private final Map<String, Object> variables;
2424
private final Object root;
25-
private final List<GraphQLError> errors = new CopyOnWriteArrayList<GraphQLError>();
25+
private final List<GraphQLError> errors = new CopyOnWriteArrayList<>();
2626
private final Instrumentation instrumentation;
2727

2828
public ExecutionContext(Instrumentation instrumentation, ExecutionId executionId, GraphQLSchema graphQLSchema, ExecutionStrategy queryStrategy, ExecutionStrategy mutationStrategy, Map<String, FragmentDefinition> fragmentsByName, OperationDefinition operationDefinition, Map<String, Object> variables, Object root) {

src/main/java/graphql/execution/ExecutionContextBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public ExecutionContext build(GraphQLSchema graphQLSchema, ExecutionStrategy que
3434
// preconditions
3535
assertNotNull(executionId, "You must provide a query identifier");
3636

37-
Map<String, FragmentDefinition> fragmentsByName = new LinkedHashMap<String, FragmentDefinition>();
38-
Map<String, OperationDefinition> operationsByName = new LinkedHashMap<String, OperationDefinition>();
37+
Map<String, FragmentDefinition> fragmentsByName = new LinkedHashMap<>();
38+
Map<String, OperationDefinition> operationsByName = new LinkedHashMap<>();
3939

4040
for (Definition definition : document.getDefinitions()) {
4141
if (definition instanceof OperationDefinition) {

src/main/java/graphql/execution/ExecutionStrategy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ protected ExecutionResult completeValue(ExecutionContext executionContext, Graph
108108
resolvedType = (GraphQLObjectType) fieldType;
109109
}
110110

111-
Map<String, List<Field>> subFields = new LinkedHashMap<String, List<Field>>();
112-
List<String> visitedFragments = new ArrayList<String>();
111+
Map<String, List<Field>> subFields = new LinkedHashMap<>();
112+
List<String> visitedFragments = new ArrayList<>();
113113
for (Field field : fields) {
114114
if (field.getSelectionSet() == null) continue;
115115
fieldCollector.collectFields(executionContext, resolvedType, field.getSelectionSet(), visitedFragments, subFields);
@@ -160,7 +160,7 @@ protected ExecutionResult completeValueForScalar(GraphQLScalarType scalarType, O
160160
}
161161

162162
protected ExecutionResult completeValueForList(ExecutionContext executionContext, GraphQLList fieldType, List<Field> fields, Iterable<Object> result) {
163-
List<Object> completedResults = new ArrayList<Object>();
163+
List<Object> completedResults = new ArrayList<>();
164164
for (Object item : result) {
165165
ExecutionResult completedValue = completeValue(executionContext, fieldType.getWrappedType(), fields, item);
166166
completedResults.add(completedValue != null ? completedValue.getData() : null);

src/main/java/graphql/execution/ExecutorServiceExecutionStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ExecutionResult execute(final ExecutionContext executionContext, final Gr
4141
if (executorService == null)
4242
return new SimpleExecutionStrategy().execute(executionContext, parentType, source, fields);
4343

44-
Map<String, Future<ExecutionResult>> futures = new LinkedHashMap<String, Future<ExecutionResult>>();
44+
Map<String, Future<ExecutionResult>> futures = new LinkedHashMap<>();
4545
for (String fieldName : fields.keySet()) {
4646
final List<Field> fieldList = fields.get(fieldName);
4747
Callable<ExecutionResult> resolveField = new Callable<ExecutionResult>() {
@@ -54,7 +54,7 @@ public ExecutionResult call() throws Exception {
5454
futures.put(fieldName, executorService.submit(resolveField));
5555
}
5656
try {
57-
Map<String, Object> results = new LinkedHashMap<String, Object>();
57+
Map<String, Object> results = new LinkedHashMap<>();
5858
for (String fieldName : futures.keySet()) {
5959
ExecutionResult executionResult = futures.get(fieldName).get();
6060

src/main/java/graphql/execution/FieldCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private void collectField(ExecutionContext executionContext, Map<String, List<Fi
6767
}
6868
String name = getFieldEntryKey(field);
6969
if (!fields.containsKey(name)) {
70-
fields.put(name, new ArrayList<Field>());
70+
fields.put(name, new ArrayList<>());
7171
}
7272
fields.get(name).add(field);
7373
}

src/main/java/graphql/execution/SimpleExecutionStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
public class SimpleExecutionStrategy extends ExecutionStrategy {
1313
@Override
1414
public ExecutionResult execute(ExecutionContext executionContext, GraphQLObjectType parentType, Object source, Map<String, List<Field>> fields) {
15-
Map<String, Object> results = new LinkedHashMap<String, Object>();
15+
Map<String, Object> results = new LinkedHashMap<>();
1616
for (String fieldName : fields.keySet()) {
1717
List<Field> fieldList = fields.get(fieldName);
1818
ExecutionResult resolvedResult = resolveField(executionContext, parentType, source, fieldList);

src/main/java/graphql/execution/ValuesResolver.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class ValuesResolver {
1111

1212

1313
public Map<String, Object> getVariableValues(GraphQLSchema schema, List<VariableDefinition> variableDefinitions, Map<String, Object> inputs) {
14-
Map<String, Object> result = new LinkedHashMap<String, Object>();
14+
Map<String, Object> result = new LinkedHashMap<>();
1515
for (VariableDefinition variableDefinition : variableDefinitions) {
1616
result.put(variableDefinition.getName(), getVariableValue(schema, variableDefinition, inputs.get(variableDefinition.getName())));
1717
}
@@ -20,7 +20,7 @@ public Map<String, Object> getVariableValues(GraphQLSchema schema, List<Variable
2020

2121

2222
public Map<String, Object> getArgumentValues(List<GraphQLArgument> argumentTypes, List<Argument> arguments, Map<String, Object> variables) {
23-
Map<String, Object> result = new LinkedHashMap<String, Object>();
23+
Map<String, Object> result = new LinkedHashMap<>();
2424
Map<String, Argument> argumentMap = argumentMap(arguments);
2525
for (GraphQLArgument fieldArgument : argumentTypes) {
2626
Argument argument = argumentMap.get(fieldArgument.getName());
@@ -37,7 +37,7 @@ public Map<String, Object> getArgumentValues(List<GraphQLArgument> argumentTypes
3737

3838

3939
private Map<String, Argument> argumentMap(List<Argument> arguments) {
40-
Map<String, Argument> result = new LinkedHashMap<String, Argument>();
40+
Map<String, Argument> result = new LinkedHashMap<>();
4141
for (Argument argument : arguments) {
4242
result.put(argument.getName(), argument);
4343
}
@@ -90,7 +90,7 @@ private Object coerceValue(GraphQLType graphQLType, Object value) {
9090
}
9191

9292
private Object coerceValueForInputObjectType(GraphQLInputObjectType inputObjectType, Map<String, Object> input) {
93-
Map<String, Object> result = new LinkedHashMap<String, Object>();
93+
Map<String, Object> result = new LinkedHashMap<>();
9494
for (GraphQLInputObjectField inputField : inputObjectType.getFields()) {
9595
if (input.containsKey(inputField.getName()) || alwaysHasValue(inputField)) {
9696
Object value = coerceValue(inputField.getType(), input.get(inputField.getName()));
@@ -115,7 +115,7 @@ private Object coerceValueForEnum(GraphQLEnumType graphQLEnumType, Object value)
115115

116116
private List coerceValueForList(GraphQLList graphQLList, Object value) {
117117
if (value instanceof Iterable) {
118-
List<Object> result = new ArrayList<Object>();
118+
List<Object> result = new ArrayList<>();
119119
for (Object val : (Iterable) value) {
120120
result.add(coerceValue(graphQLList.getWrappedType(), val));
121121
}
@@ -150,7 +150,7 @@ private Object coerceValueAst(GraphQLType type, Value inputValue, Map<String, Ob
150150
private Object coerceValueAstForList(GraphQLList graphQLList, Value value, Map<String, Object> variables) {
151151
if (value instanceof ArrayValue) {
152152
ArrayValue arrayValue = (ArrayValue) value;
153-
List<Object> result = new ArrayList<Object>();
153+
List<Object> result = new ArrayList<>();
154154
for (Value singleValue : arrayValue.getValues()) {
155155
result.add(coerceValueAst(graphQLList.getWrappedType(), singleValue, variables));
156156
}
@@ -161,7 +161,7 @@ private Object coerceValueAstForList(GraphQLList graphQLList, Value value, Map<S
161161
}
162162

163163
private Object coerceValueAstForInputObject(GraphQLInputObjectType type, ObjectValue inputValue, Map<String, Object> variables) {
164-
Map<String, Object> result = new LinkedHashMap<String, Object>();
164+
Map<String, Object> result = new LinkedHashMap<>();
165165

166166
Map<String, ObjectField> inputValueFieldsByName = mapObjectValueFieldsByName(inputValue);
167167

@@ -184,7 +184,7 @@ private Object coerceValueAstForInputObject(GraphQLInputObjectType type, ObjectV
184184
}
185185

186186
private Map<String, ObjectField> mapObjectValueFieldsByName(ObjectValue inputValue) {
187-
Map<String, ObjectField> inputValueFieldsByName = new LinkedHashMap<String, ObjectField>();
187+
Map<String, ObjectField> inputValueFieldsByName = new LinkedHashMap<>();
188188
for (ObjectField objectField : inputValue.getObjectFields()) {
189189
inputValueFieldsByName.put(objectField.getName(), objectField);
190190
}

0 commit comments

Comments
 (0)