Repository: quarkusio/quarkus
Issue: How to properly register XMLGregorianCalendar?

Already for some time some warning is bugging me when our Quarkus app is starting up. This is regardless of the Quarkus version, seeing this warning on both 1.10 and 1.11

We generate some Java code from XSD files for a REST Client implementation using JAXB. The XSD contains a datetime field which translates to a `javax.xml.datatype.XMLGregorianCalendar`. And gives me the following warning on start up:

```
2021-01-23 11:13:19,751 WARN  [io.qua.dep.ste.ReflectiveHierarchyStep] (build-6) Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
        - javax.xml.datatype.XMLGregorianCalendar (source: RestClientProcessor > nl.wjglerum.xml.Prices)
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.");.
```

I tried the following options without any success:
- adding an empty `beans.xml` in `META-INF`
- adding the jandex maven plugin to build the Jandex index
- adding an annotation to register the class with `@RegisterForReflection(targets = XMLGregorianCalendar.class)`
- adding it using `application.properties`, unfortunately I couldn't figure out what to add here.

Sample repo to reproduce the warning: https://github.com/wjglerum/quarkus-xml

Also see zulip https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/How.20to.20properly.20register.20XMLGregorianCalendar.3F

Changed files:
extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java

diff --git a/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java b/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java
index 25907901934..9b36faf6761 100644
--- a/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java
+++ b/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java
@@ -61,6 +61,7 @@
 import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyIgnoreWarningBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
 
@@ -110,6 +111,9 @@ class JaxbProcessor {
 
     private static final List<DotName> JAXB_ROOT_ANNOTATIONS = Arrays.asList(XML_ROOT_ELEMENT, XML_TYPE, XML_REGISTRY);
 
+    private static final List<DotName> IGNORE_TYPES = Collections
+            .singletonList(DotName.createSimple("javax.xml.datatype.XMLGregorianCalendar"));
+
     @Inject
     ApplicationArchivesBuildItem applicationArchivesBuildItem;
 
@@ -178,6 +182,13 @@ void processAnnotationsAndIndexFiles(
         }
     }
 
+    @BuildStep
+    void ignoreWarnings(BuildProducer<ReflectiveHierarchyIgnoreWarningBuildItem> ignoreWarningProducer) {
+        for (DotName type : IGNORE_TYPES) {
+            ignoreWarningProducer.produce(new ReflectiveHierarchyIgnoreWarningBuildItem(type));
+        }
+    }
+
     @BuildStep
     void registerClasses(
             BuildProducer<NativeImageSystemPropertyBuildItem> nativeImageProps,