22
33import graphql .GraphQLError ;
44import graphql .Internal ;
5- import graphql .collect .ImmutableKit ;
65import graphql .introspection .Introspection .DirectiveLocation ;
76import graphql .language .Argument ;
87import graphql .language .Directive ;
@@ -148,10 +147,13 @@ private void checkDirectives(DirectiveLocation expectedLocation, List<GraphQLErr
148147 });
149148 }
150149
151- private boolean inRightLocation (DirectiveLocation expectedLocation , DirectiveDefinition directiveDefinition ) {
152- List <String > names = ImmutableKit .map (directiveDefinition .getDirectiveLocations (),
153- it -> it .getName ().toUpperCase ());
154- return names .contains (expectedLocation .name ().toUpperCase ());
150+ private static boolean inRightLocation (DirectiveLocation expectedLocation , DirectiveDefinition directiveDefinition ) {
151+ for (graphql .language .DirectiveLocation location : directiveDefinition .getDirectiveLocations ()) {
152+ if (location .getName ().equalsIgnoreCase (expectedLocation .name ())) {
153+ return true ;
154+ }
155+ }
156+ return false ;
155157 }
156158
157159 private void checkDirectiveArguments (List <GraphQLError > errors , TypeDefinitionRegistry typeRegistry , Node <?> element , String elementName , Directive directive , DirectiveDefinition directiveDefinition ) {
@@ -175,7 +177,7 @@ private void checkDirectiveArguments(List<GraphQLError> errors, TypeDefinitionRe
175177 });
176178 }
177179
178- private boolean isNoNullArgWithoutDefaultValue (InputValueDefinition definitionArgument ) {
180+ private static boolean isNoNullArgWithoutDefaultValue (InputValueDefinition definitionArgument ) {
179181 return definitionArgument .getType () instanceof NonNullType && definitionArgument .getDefaultValue () == null ;
180182 }
181183
@@ -192,7 +194,7 @@ private void commonCheck(Collection<DirectiveDefinition> directiveDefinitions, L
192194 });
193195 }
194196
195- private void assertTypeName (NamedNode <?> node , List <GraphQLError > errors ) {
197+ private static void assertTypeName (NamedNode <?> node , List <GraphQLError > errors ) {
196198 if (node .getName ().length () >= 2 && node .getName ().startsWith ("__" )) {
197199 errors .add ((new IllegalNameError (node )));
198200 }
@@ -215,7 +217,7 @@ public void assertExistAndIsInputType(InputValueDefinition definition, List<Grap
215217 }
216218 }
217219
218- private TypeDefinition <?> findTypeDefFromRegistry (String typeName , TypeDefinitionRegistry typeRegistry ) {
220+ private static TypeDefinition <?> findTypeDefFromRegistry (String typeName , TypeDefinitionRegistry typeRegistry ) {
219221 TypeDefinition <?> typeDefinition = typeRegistry .getTypeOrNull (typeName );
220222 if (typeDefinition != null ) {
221223 return typeDefinition ;
0 commit comments