From e860593add65c1e4ee00b04660de2e0f8afb5ee0 Mon Sep 17 00:00:00 2001 From: osher-sade Date: Tue, 9 Jul 2019 14:12:34 +0300 Subject: [PATCH] checking for synthetic fields in more places --- .../annotations/processor/directives/DirectiveCreator.java | 4 ++-- .../java/graphql/annotations/processor/util/ObjectUtil.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/graphql/annotations/processor/directives/DirectiveCreator.java b/src/main/java/graphql/annotations/processor/directives/DirectiveCreator.java index ff846adb..94820472 100644 --- a/src/main/java/graphql/annotations/processor/directives/DirectiveCreator.java +++ b/src/main/java/graphql/annotations/processor/directives/DirectiveCreator.java @@ -50,8 +50,8 @@ public GraphQLDirective getDirective(Class annotatedClass) { private void buildArguments(GraphQLDirective.Builder builder, Class annotatedClass) { Arrays.stream(annotatedClass.getDeclaredFields()) - .filter(x -> !x.isSynthetic()) - .forEach(x -> builder.argument(directiveArgumentCreator.getArgument(x, annotatedClass))); + .filter(field -> !field.isSynthetic()) + .forEach(field -> builder.argument(directiveArgumentCreator.getArgument(field, annotatedClass))); } private Introspection.DirectiveLocation[] getValidLocations(Class annotatedClass) { diff --git a/src/main/java/graphql/annotations/processor/util/ObjectUtil.java b/src/main/java/graphql/annotations/processor/util/ObjectUtil.java index f4c23ffa..3f28395f 100644 --- a/src/main/java/graphql/annotations/processor/util/ObjectUtil.java +++ b/src/main/java/graphql/annotations/processor/util/ObjectUtil.java @@ -18,7 +18,7 @@ import java.util.Map; import java.util.TreeMap; -public class ObjectUtil { +public class ObjectUtil { public static Map getAllFields(Class c) { Map fields; @@ -30,7 +30,9 @@ public static Map getAllFields(Class c) { } for (Field f : c.getDeclaredFields()) { - fields.put(f.getName(), f); + if (!f.isSynthetic()) { + fields.put(f.getName(), f); + } } return fields;