Skip to content

Commit 52e229e

Browse files
committed
Move ref down closer to usage
1 parent c083b64 commit 52e229e

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/main/java/graphql/normalized/ExecutableNormalizedField.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,6 @@ private void traverseImpl(ExecutableNormalizedField root,
510510
*/
511511
@SuppressWarnings({"unchecked", "rawtypes"})
512512
private Set<GraphQLInterfaceType> getInterfacesCommonToAllOutputTypes(GraphQLSchema schema) {
513-
Ref<Set<GraphQLInterfaceType>> ref = new Ref<>();
514-
515513
// Shortcut for performance
516514
if (objectTypeNames.size() == 1) {
517515
var fieldDef = getOneFieldDefinition(schema);
@@ -528,6 +526,7 @@ private Set<GraphQLInterfaceType> getInterfacesCommonToAllOutputTypes(GraphQLSch
528526
}
529527
}
530528

529+
Ref<Set<GraphQLInterfaceType>> commonInterfaces = new Ref<>();
531530
forEachFieldDefinition(schema, (fieldDef) -> {
532531
var outputType = unwrapAll(fieldDef.getType());
533532

@@ -548,14 +547,14 @@ private Set<GraphQLInterfaceType> getInterfacesCommonToAllOutputTypes(GraphQLSch
548547
outputTypeInterfaces = Collections.emptyList();
549548
}
550549

551-
if (ref.value == null) {
552-
ref.value = new LinkedHashSet<>(outputTypeInterfaces);
550+
if (commonInterfaces.value == null) {
551+
commonInterfaces.value = new LinkedHashSet<>(outputTypeInterfaces);
553552
} else {
554-
ref.value.retainAll(outputTypeInterfaces);
553+
commonInterfaces.value.retainAll(outputTypeInterfaces);
555554
}
556555
});
557556

558-
return ref.value;
557+
return commonInterfaces.value;
559558
}
560559

561560
/**

0 commit comments

Comments
 (0)