Repository: quarkusio/quarkus
Issue: GraphQL queries returning Collection.class are broken in native mode

Any time I attempt to perform a GraphQL query returning a `Collection<Something>` (it works correctly with `List<Something>`) against Quarkus in native mode, I get this
```
2021-03-09 10:43:52,601 ERROR [io.sma.graphql] (vert.x-worker-thread-0) SRGQL012000: Data Fetching Error: java.lang.RuntimeException: Can not load class [java.util.Collection]
	at io.quarkus.smallrye.graphql.runtime.spi.QuarkusClassloadingService.loadClass(QuarkusClassloadingService.java:47)
	at io.smallrye.graphql.execution.datafetcher.CollectionCreator.newCollection(CollectionCreator.java:27)
	at io.smallrye.graphql.execution.datafetcher.helper.AbstractHelper.recursiveTransformCollection(AbstractHelper.java:203)
	at io.smallrye.graphql.execution.datafetcher.helper.AbstractHelper.recursiveTransform(AbstractHelper.java:72)
	at io.smallrye.graphql.execution.datafetcher.helper.FieldHelper.transformResponse(FieldHelper.java:32)
	at io.smallrye.graphql.execution.datafetcher.DefaultDataFetcher.invokeAndTransform(DefaultDataFetcher.java:39)
	at io.smallrye.graphql.execution.datafetcher.AbstractDataFetcher.get(AbstractDataFetcher.java:62)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:270)
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:203)
	at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:60)
	at graphql.execution.Execution.executeOperation(Execution.java:165)
	at graphql.execution.Execution.execute(Execution.java:104)
	at graphql.GraphQL.execute(GraphQL.java:557)
	at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:482)
	at graphql.GraphQL.executeAsync(GraphQL.java:446)
	at graphql.GraphQL.execute(GraphQL.java:377)
	at io.smallrye.graphql.execution.ExecutionService.execute(ExecutionService.java:130)
	at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doRequest(SmallRyeGraphQLExecutionHandler.java:176)
	at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doRequest(SmallRyeGraphQLExecutionHandler.java:169)
	at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.handlePost(SmallRyeGraphQLExecutionHandler.java:112)
	at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doHandle(SmallRyeGraphQLExecutionHandler.java:93)
	at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.handle(SmallRyeGraphQLExecutionHandler.java:64)
	at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.handle(SmallRyeGraphQLExecutionHandler.java:37)
	at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:834)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
Caused by: java.security.PrivilegedActionException: java.lang.ClassNotFoundException: java.util.Collection
	at java.security.AccessController.doPrivileged(AccessController.java:122)
	at io.quarkus.smallrye.graphql.runtime.spi.QuarkusClassloadingService.loadClass(QuarkusClassloadingService.java:41)
	... 30 more
Caused by: java.lang.ClassNotFoundException: java.util.Collection
	at com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:60)
	at java.lang.Class.forName(DynamicHub.java:1260)
	at io.smallrye.graphql.spi.ClassloadingService.loadClass(ClassloadingService.java:66)
	at io.quarkus.smallrye.graphql.runtime.spi.QuarkusClassloadingService.lambda$loadClass$0(QuarkusClassloadingService.java:43)
	at java.security.AccessController.doPrivileged(AccessController.java:120)
	... 31 more
```

Changed files:
integration-tests/smallrye-graphql/src/main/java/io/quarkus/it/smallrye/graphql/GreetingResource.java
extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
integration-tests/smallrye-graphql/src/test/java/io/quarkus/it/smallrye/graphql/GreetingResourceTest.java

diff --git a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
index 50a616dc55d..177613933e3 100644
--- a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
+++ b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
@@ -268,6 +268,7 @@ private Class[] getGraphQLJavaClasses() {
         classes.add(graphql.schema.GraphQLSchema.class);
         classes.add(graphql.schema.GraphQLTypeReference.class);
         classes.add(List.class);
+        classes.add(Collection.class);
         return classes.toArray(new Class[] {});
     }
 
diff --git a/integration-tests/smallrye-graphql/src/main/java/io/quarkus/it/smallrye/graphql/GreetingResource.java b/integration-tests/smallrye-graphql/src/main/java/io/quarkus/it/smallrye/graphql/GreetingResource.java
index d5dcd75dab4..e3708cb98a7 100644
--- a/integration-tests/smallrye-graphql/src/main/java/io/quarkus/it/smallrye/graphql/GreetingResource.java
+++ b/integration-tests/smallrye-graphql/src/main/java/io/quarkus/it/smallrye/graphql/GreetingResource.java
@@ -2,6 +2,7 @@
 
 import java.time.LocalTime;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import org.eclipse.microprofile.config.inject.ConfigProperty;
@@ -36,6 +37,13 @@ public Greetings load(Greetings greetings) {
     public List<Greeting> buildInOptions(@Source Greeting greeting) {
         List<Greeting> options = new ArrayList<>();
         options.add(new Hello());
+        return options;
+    }
+
+    @Name("options2")
+    // make sure that returning Collection.class does not break native mode
+    public Collection<Greeting> buildInOptionsCollection(@Source Greeting greeting) {
+        List<Greeting> options = new ArrayList<>();
         options.add(new Morning());
         return options;
     }
diff --git a/integration-tests/smallrye-graphql/src/test/java/io/quarkus/it/smallrye/graphql/GreetingResourceTest.java b/integration-tests/smallrye-graphql/src/test/java/io/quarkus/it/smallrye/graphql/GreetingResourceTest.java
index fb313728f51..9ff8af8a1d9 100644
--- a/integration-tests/smallrye-graphql/src/test/java/io/quarkus/it/smallrye/graphql/GreetingResourceTest.java
+++ b/integration-tests/smallrye-graphql/src/test/java/io/quarkus/it/smallrye/graphql/GreetingResourceTest.java
@@ -22,6 +22,9 @@ void testEndpoint() {
                 "    options{\\n" +
                 "       message\\n" +
                 "    }\\n" +
+                "    options2{\\n" +
+                "       message\\n" +
+                "    }\\n" +
                 "  }\\n" +
                 "  farewell:farewell{\\n" +
                 "    type\\n" +